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