Skip to content

Commit

Permalink
Some extra debug and attempt to shutdown on writing a close response
Browse files Browse the repository at this point in the history
  • Loading branch information
locka99 committed Sep 3, 2019
1 parent 1ab6149 commit fdb43a8
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 1 deletion.
3 changes: 2 additions & 1 deletion client/src/comms/tcp_transport.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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
Expand Down
24 changes: 24 additions & 0 deletions server/src/comms/tcp_transport.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<RwLock<TcpTransport>>, 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);
Expand Down

0 comments on commit fdb43a8

Please sign in to comment.