Skip to content

Commit

Permalink
make sure cancel read routine on break
Browse files Browse the repository at this point in the history
  • Loading branch information
muhamadazmy committed Dec 12, 2023
1 parent d8fd14a commit 1624623
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/peer/socket.rs
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,6 @@ async fn retainer<S: Signer>(
let now = timestamp();
if now - ts.load(Ordering::Relaxed) > READ_TIMEOUT {
// we have timed out! we need to reconnect then
handler.abort();
log::info!("connection timeout! retrying");
break 'receive
}
Expand Down Expand Up @@ -184,6 +183,8 @@ async fn retainer<S: Signer>(

}
}
// make sure read routine is fully closed
handler.abort();
tokio::time::sleep(Duration::from_secs(2)).await;
}
}
Expand Down

0 comments on commit 1624623

Please sign in to comment.