Bugfix/closing tcp client connections on drop (#167)

* Filtering out early eof errors

* Wrapping ConnectionManager in Abortable

* Decreased pathchecker logging level

* Client aborting all connection futures on drop

* Moved AbortHandle to connection_managers HashMap to couple them closer together
This commit is contained in:
Jędrzej Stuczyński
2020-04-02 15:38:21 +01:00
committed by GitHub
parent c401222a84
commit d02e248328
6 changed files with 86 additions and 37 deletions
+12 -4
View File
@@ -48,6 +48,8 @@ async fn process_socket_connection(
return;
}
Ok(n) => {
// If I understand it correctly, this if should never be executed as if `read_exact`
// does not fill buffer, it will throw UnexpectedEof?
if n != sphinx::PACKET_SIZE {
warn!("read data of different length than expected sphinx packet size - {} (expected {})", n, sphinx::PACKET_SIZE);
continue;
@@ -63,10 +65,16 @@ async fn process_socket_connection(
))
}
Err(e) => {
warn!(
"failed to read from socket. Closing the connection; err = {:?}",
e
);
if e.kind() == io::ErrorKind::UnexpectedEof {
debug!("Read buffer was not fully filled. Most likely the client ({:?}) closed the connection.\
Also closing the connection on this end.", socket.peer_addr())
} else {
warn!(
"failed to read from socket (source: {:?}). Closing the connection; err = {:?}",
socket.peer_addr(),
e
);
}
return;
}
};