cli: Log connection errors during dx serve in desktop apps (#1515)
* cli: Log connection errors during `dx serve` in desktop apps * add a note about the dioxus CLI --------- Co-authored-by: Evan Almloff <evanalmloff@gmail.com>
This commit is contained in:
1 parent
95d8843d9d
commit
0d7bc86250
1 file changed
+26
-19
@@ -124,27 +124,34 @@ async fn start_desktop_hot_reload(hot_reload_state: HotReloadState) -> Result<()
|
|||||||
let _ = local_socket_stream.set_nonblocking(true);
|
let _ = local_socket_stream.set_nonblocking(true);
|
||||||
move || {
|
move || {
|
||||||
loop {
|
loop {
|
||||||
if let Ok(mut connection) = local_socket_stream.accept() {
|
match local_socket_stream.accept() {
|
||||||
// send any templates than have changed before the socket connected
|
Ok(mut connection) => {
|
||||||
let templates: Vec<_> = {
|
// send any templates than have changed before the socket connected
|
||||||
file_map
|
let templates: Vec<_> = {
|
||||||
.lock()
|
file_map
|
||||||
.unwrap()
|
.lock()
|
||||||
.map
|
.unwrap()
|
||||||
.values()
|
.map
|
||||||
.filter_map(|(_, template_slot)| *template_slot)
|
.values()
|
||||||
.collect()
|
.filter_map(|(_, template_slot)| *template_slot)
|
||||||
};
|
.collect()
|
||||||
for template in templates {
|
};
|
||||||
if !send_msg(
|
for template in templates {
|
||||||
HotReloadMsg::UpdateTemplate(template),
|
if !send_msg(
|
||||||
&mut connection,
|
HotReloadMsg::UpdateTemplate(template),
|
||||||
) {
|
&mut connection,
|
||||||
continue;
|
) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
channels.lock().unwrap().push(connection);
|
||||||
|
println!("Connected to hot reloading 🚀");
|
||||||
|
}
|
||||||
|
Err(err) => {
|
||||||
|
if err.kind() != std::io::ErrorKind::WouldBlock {
|
||||||
|
println!("Error connecting to hot reloading: {} (Hot reloading is a feature of the dioxus-cli. If you are not using the CLI, this error can be ignored)", err);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
channels.lock().unwrap().push(connection);
|
|
||||||
println!("Connected to hot reloading 🚀");
|
|
||||||
}
|
}
|
||||||
if *aborted.lock().unwrap() {
|
if *aborted.lock().unwrap() {
|
||||||
break;
|
break;
|
||||||
|
|||||||
Reference in new issue
Block a user