diff --git a/tcp_relay_client/src/relay_client.rs b/tcp_relay_client/src/relay_client.rs index d8a7e74..02d0da9 100644 --- a/tcp_relay_client/src/relay_client.rs +++ b/tcp_relay_client/src/relay_client.rs @@ -41,9 +41,15 @@ async fn relay_connection(ws_url: String, socket: TcpStream) { loop { match tcp_read.read(&mut buff).await { Ok(s) => { + if s == 0 { + log::info!("Got empty read TCP buffer. Stopping..."); + break; + } + if let Err(e) = ws_write.send(Message::Binary(Vec::from(&buff[0..s]))).await { log::error!( "Failed to write to WS connection! {:?} Exiting TCP read -> WS write loop...",e); + break; } } Err(e) => {