From 1eb126736d9f0d7c152c03a0aee8bcec9cf40034 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcel=20M=C3=A4rtens?= Date: Sat, 22 Aug 2020 00:50:01 +0200 Subject: [PATCH] workaround for impossible RAW msg --- network/src/channel.rs | 14 +++++++++----- network/src/participant.rs | 5 ++++- network/src/protocols.rs | 1 + 3 files changed, 14 insertions(+), 6 deletions(-) diff --git a/network/src/channel.rs b/network/src/channel.rs index 6e9a4c5e43..6eae373ac5 100644 --- a/network/src/channel.rs +++ b/network/src/channel.rs @@ -50,13 +50,13 @@ impl Channel { //reapply leftovers from handshake let cnt = leftover_cid_frame.len(); - trace!(?self.cid, ?cnt, "Reapplying leftovers"); + trace!(?cnt, "Reapplying leftovers"); for cid_frame in leftover_cid_frame.drain(..) { w2c_cid_frame_s.send(cid_frame).await.unwrap(); } - trace!(?self.cid, ?cnt, "All leftovers reapplied"); + trace!(?cnt, "All leftovers reapplied"); - trace!(?self.cid, "Start up channel"); + trace!("Start up channel"); match protocol { Protocols::Tcp(tcp) => { join!( @@ -72,7 +72,7 @@ impl Channel { }, } - trace!(?self.cid, "Shut down channel"); + trace!("Shut down channel"); } } @@ -148,7 +148,11 @@ impl Handshake { } let cnt = leftover_frames.len(); if cnt > 0 { - debug!(?self.cid, ?cnt, "Some additional frames got already transfered, piping them to the bparticipant as leftover_frames"); + debug!( + ?cnt, + "Some additional frames got already transfered, piping them to the \ + bparticipant as leftover_frames" + ); } Ok((res.0, res.1, res.2, leftover_frames)) }, diff --git a/network/src/participant.rs b/network/src/participant.rs index 607b83e925..741d85fa2b 100644 --- a/network/src/participant.rs +++ b/network/src/participant.rs @@ -448,7 +448,10 @@ impl BParticipant { self.close_api(Some(ParticipantError::ParticipantDisconnected)) .await; }, - f => unreachable!("Frame should never reache participant!: {:?}", f), + f => { + //unreachable!("Frame should never reache participant!: {:?}", f); + error!(?f, ?cid, "Frame should never reache participant!"); + }, } } if dropped_cnt > 0 { diff --git a/network/src/protocols.rs b/network/src/protocols.rs index 910b11d5c6..65541d4dc1 100644 --- a/network/src/protocols.rs +++ b/network/src/protocols.rs @@ -208,6 +208,7 @@ impl TcpProtocol { //keep the first byte! read_or_close!(&mut data[1..]); data[0] = other; + warn!(?data, "got a unexpected RAW msg"); Frame::Raw(data) }, };