diff --git a/client/src/comms/tcp_transport.rs b/client/src/comms/tcp_transport.rs index 00b70e028..30522a3e7 100644 --- a/client/src/comms/tcp_transport.rs +++ b/client/src/comms/tcp_transport.rs @@ -14,7 +14,7 @@ use futures::future::{self}; use futures::sync::mpsc::UnboundedReceiver; use tokio; use tokio::net::TcpStream; -use tokio_io::AsyncRead; +use tokio_io::{AsyncRead, AsyncWrite}; use tokio_io::io::{self, ReadHalf, WriteHalf}; use tokio_codec::FramedRead; use tokio_timer::Interval; @@ -497,6 +497,7 @@ impl TcpTransport { if close_connection { info!("Received a close, so closing connection after this send"); set_connection_state!(connection.state, ConnectionState::Finished(StatusCode::Good)); + let _ = connection.writer.as_mut().unwrap().shutdown(); } } else { // panic or not, perhaps there is a race diff --git a/server/src/comms/tcp_transport.rs b/server/src/comms/tcp_transport.rs index e5b419ce8..b62cbd3c9 100644 --- a/server/src/comms/tcp_transport.rs +++ b/server/src/comms/tcp_transport.rs @@ -173,6 +173,30 @@ impl TcpTransport { /// This is the entry point for the session. This function is asynchronous - it spawns tokio /// tasks to handle the session execution loop so this function will returns immediately. pub fn run(connection: Arc>, socket: TcpStream, looping_interval_ms: f64) { + info!("Socket info:\n Linger - {}\n Keepalive - {},\n TTL - {}", + if let Ok(v) = socket.linger() { + match v { + Some(d) => format!("{}ms", d.as_millis()), + None => "No linger".to_string(), + } + } else { + "No Linger (err)".to_string() + }, + if let Ok(v) = socket.keepalive() { + match v { + Some(d) => format!("{}ms", d.as_millis()), + None => "No Keepalive".to_string(), + } + } else { + "No Keepalive (err)".to_string() + }, + if let Ok(v) = socket.ttl() { + format!("{}", v) + } else { + "No TTL".to_string() + } + ); + // Store the address of the client { let mut connection = trace_write_lock_unwrap!(connection);