debug of possible deadlock
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Paul 2023-05-07 10:52:00 +02:00
parent 43d3137dd2
commit f559fa9fd0

View File

@ -64,9 +64,8 @@ pub async fn run() {
ipevent = ipeventrx.recv() => {
let received_ip = ipevent.unwrap();
let mut ctx = ctxclone.write().await;
if received_ip.msgtype == "bootstrap".to_string() {
let mut ctx = ctxclone.write().await;
for ip_to_send in ctx.get_blocklist_toblock().await {
let ipe = IpEvent{
msgtype: String::from("init"),
@ -84,8 +83,13 @@ pub async fn run() {
continue
}
let (filtered_ipevent,server);
{
let mut ctx = ctxclone.write().await;
// refresh context blocklist
let filtered_ipevent = ctx.update_blocklist(&received_ip).await;
filtered_ipevent = ctx.update_blocklist(&received_ip).await;
server = ctx.flags.server.clone();
}
// send ip list to api and ws sockets
if let Some(ipevent) = filtered_ipevent {
@ -97,9 +101,8 @@ pub async fn run() {
hostname: gethostname(true),
ipdata: ipevent.ipdata,
};
send_to_ipbl_api(&ctx.flags.server, &ipe).await;
send_to_ipbl_api(&server, &ipe).await;
let status = send_to_ipbl_websocket(&mut wssocketrr, &ipe).await;
drop(ctx);
if !status {
wssocketrr = websocketreqrep(&ctxwsrr).await;
continue;