bugfix: drop tasks to connections closed by remote (#3190)

* applied patch #3187

* applied the same concept to the verloc listener
This commit is contained in:
Jędrzej Stuczyński
2023-03-23 11:09:43 +00:00
committed by GitHub
parent a7610a7a88
commit 5e04f48500
3 changed files with 22 additions and 16 deletions
@@ -189,9 +189,9 @@ impl<St: Storage> ConnectionHandler<St> {
_ = shutdown.recv() => {
log::trace!("ConnectionHandler: received shutdown");
}
Some(framed_sphinx_packet) = framed_conn.next() => {
framed_sphinx_packet = framed_conn.next() => {
match framed_sphinx_packet {
Ok(framed_sphinx_packet) => {
Some(Ok(framed_sphinx_packet)) => {
// TODO: benchmark spawning tokio task with full processing vs just processing it
// synchronously under higher load in single and multi-threaded situation.
@@ -200,12 +200,13 @@ impl<St: Storage> ConnectionHandler<St> {
// that change would only slow things down
self.handle_received_packet(framed_sphinx_packet).await;
}
Err(err) => {
Some(Err(err)) => {
error!(
"The socket connection got corrupted with error: {err}. Closing the socket",
);
return;
}
None => break, // stream got closed by remote
}
}
}