fix of websocket error #10

Merged
paulbsd merged 3 commits from develop into master 2023-11-25 18:01:13 +01:00
Showing only changes of commit 46a01efeea - Show all commits

View File

@ -105,11 +105,13 @@ pub async fn send_to_ipbl_websocket(
Ok(_) => {} Ok(_) => {}
Err(e) => { Err(e) => {
println!("err send read: {e:?}"); println!("err send read: {e:?}");
return handle_websocket_error(ws); ws.close(None).unwrap_or(());
return false;
} }
}; };
} else { } else {
return handle_websocket_error(ws); ws.close(None).unwrap_or(());
return false;
}; };
if ws.can_read() { if ws.can_read() {
@ -117,19 +119,13 @@ pub async fn send_to_ipbl_websocket(
Ok(_) => {} Ok(_) => {}
Err(e) => { Err(e) => {
println!("err send read: {e:?}"); println!("err send read: {e:?}");
return handle_websocket_error(ws); ws.close(None).unwrap_or(());
return false;
} }
}; };
} else { } else {
return handle_websocket_error(ws); ws.close(None).unwrap_or(());
return false;
}; };
true true
} }
fn handle_websocket_error(ws: &mut WebSocket<MaybeTlsStream<TcpStream>>) -> bool {
match ws.close(None) {
Ok(o) => {}
Err(e) => {}
};
return false;
}