diff --git a/src/client.rs b/src/client.rs index 9f1bdcb..9460231 100644 --- a/src/client.rs +++ b/src/client.rs @@ -364,12 +364,14 @@ impl ControlChannel { .with_context(|| format!("Failed to connect to the server: {}", &self.remote_addr))?; // Send hello + debug!("Sending hello"); let hello_send = Hello::ControlChannelHello(CURRENT_PROTO_VRESION, self.digest[..].try_into().unwrap()); conn.write_all(&bincode::serialize(&hello_send).unwrap()) .await?; // Read hello)) + debug!("Reading hello"); let nonce = match read_hello(&mut conn) .await .with_context(|| "Failed to read hello from the server")? @@ -381,6 +383,7 @@ impl ControlChannel { }; // Send auth + debug!("Sending auth"); let mut concat = Vec::from(self.service.token.as_ref().unwrap().as_bytes()); concat.extend_from_slice(&nonce); @@ -389,6 +392,7 @@ impl ControlChannel { conn.write_all(&bincode::serialize(&auth).unwrap()).await?; // Read ack + debug!("Reading ack"); match read_ack(&mut conn).await? { Ack::Ok => {} v => { @@ -444,6 +448,8 @@ impl ControlChannelHandle { transport: Arc, ) -> ControlChannelHandle { let digest = protocol::digest(service.name.as_bytes()); + + info!("Starting {}", hex::encode(digest)); let (shutdown_tx, shutdown_rx) = oneshot::channel(); let mut s = ControlChannel { digest, diff --git a/src/server.rs b/src/server.rs index d458da6..b97efc4 100644 --- a/src/server.rs +++ b/src/server.rs @@ -353,9 +353,6 @@ where // and the connection pool task are created. #[instrument(skip_all, fields(service = %service.name))] fn new(conn: T::Stream, service: ServerServiceConfig) -> ControlChannelHandle { - // Save the name string for logging - let name = service.name.clone(); - // Create a shutdown channel let (shutdown_tx, shutdown_rx) = broadcast::channel::(1); @@ -407,11 +404,14 @@ where }; // Run the control channel - tokio::spawn(async move { - if let Err(err) = ch.run().await { - error!(%name, "{}", err); + tokio::spawn( + async move { + if let Err(err) = ch.run().await { + error!("{:?}", err); + } } - }); + .instrument(Span::current()), + ); ControlChannelHandle { _shutdown_tx: shutdown_tx, @@ -513,10 +513,10 @@ fn tcp_listen_and_send( } Ok((incoming, addr)) => { // For every visitor, request to create a data channel - if let Err(e) = data_ch_req_tx.send(true) { + if let Err(e) = data_ch_req_tx.send(true).with_context(|| "Failed to send data chan create request") { // An error indicates the control channel is broken // So break the loop - error!("{}", e); + error!("{:?}", e); break; } @@ -534,7 +534,7 @@ fn tcp_listen_and_send( } } } - }); + }.instrument(Span::current())); rx }