hotfix on ws connections
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/tag Build is passing

This commit is contained in:
Paul 2023-12-26 11:11:38 +01:00
parent bae5443ca4
commit 2e6e7efdbf

View File

@ -50,13 +50,18 @@ pub async fn websocketpubsub(
continue; continue;
} }
}; };
if tosend.ipdata.clone().unwrap().hostname != gethostname(true) match tosend.ipdata.clone() {
Some(o) => {
if o.hostname != gethostname(true)
|| tosend.msgtype == "init".to_string() || tosend.msgtype == "init".to_string()
{ {
let txps = txpubsub.read().await; let txps = txpubsub.read().await;
txps.send(tosend).await.unwrap(); txps.send(tosend).await.unwrap();
} }
} }
None => {}
}
}
Err(e) => { Err(e) => {
println!("error in pubsub: {e:?}"); println!("error in pubsub: {e:?}");
ws.close(None).unwrap(); ws.close(None).unwrap();
@ -111,7 +116,9 @@ pub async fn send_to_ipbl_websocket(
} }
}; };
} else { } else {
println!("can't write to socket");
ws.close(None).unwrap_or(()); ws.close(None).unwrap_or(());
sleep_s(1);
return false; return false;
}; };
@ -125,6 +132,8 @@ pub async fn send_to_ipbl_websocket(
} }
}; };
} else { } else {
println!("can't read from socket");
sleep_s(1);
ws.close(None).unwrap_or(()); ws.close(None).unwrap_or(());
return false; return false;
}; };