Skip to content

Commit e300ba3

Browse files
authored
protocols/plaintext: Remove wrong debug log (#1759)
Don't log errors happening after plaintext handshake as errors happening during plaintext handshake.
1 parent dbf5a85 commit e300ba3

File tree

4 files changed

+11
-11
lines changed

4 files changed

+11
-11
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ libp2p-kad = { version = "0.23.1", path = "protocols/kad", optional = true }
7171
libp2p-mplex = { version = "0.22.0", path = "muxers/mplex", optional = true }
7272
libp2p-noise = { version = "0.24.1", path = "protocols/noise", optional = true }
7373
libp2p-ping = { version = "0.22.0", path = "protocols/ping", optional = true }
74-
libp2p-plaintext = { version = "0.22.0", path = "protocols/plaintext", optional = true }
74+
libp2p-plaintext = { version = "0.22.1", path = "protocols/plaintext", optional = true }
7575
libp2p-pnet = { version = "0.19.1", path = "protocols/pnet", optional = true }
7676
libp2p-request-response = { version = "0.3.0", path = "protocols/request-response", optional = true }
7777
libp2p-swarm = { version = "0.22.0", path = "swarm" }

protocols/plaintext/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
# 0.22.1 [unreleased]
2+
3+
- Improve error logging.
4+
15
# 0.22.0 [2020-09-09]
26

37
- Bump `libp2p-core` dependency.

protocols/plaintext/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
name = "libp2p-plaintext"
33
edition = "2018"
44
description = "Plaintext encryption dummy protocol for libp2p"
5-
version = "0.22.0"
5+
version = "0.22.1"
66
authors = ["Parity Technologies <[email protected]>"]
77
license = "MIT"
88
repository = "https://github.com/libp2p/rust-libp2p"

protocols/plaintext/src/lib.rs

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -152,24 +152,20 @@ impl PlainText2Config {
152152
where
153153
T: AsyncRead + AsyncWrite + Send + Unpin + 'static
154154
{
155-
debug!("Starting plaintext upgrade");
155+
debug!("Starting plaintext handshake.");
156156
let (stream_sink, remote) = PlainTextMiddleware::handshake(socket, self).await?;
157-
let mapped = stream_sink.map_err(map_err as fn(_) -> _);
157+
debug!("Finished plaintext handshake.");
158+
158159
Ok((
159160
remote.peer_id,
160161
PlainTextOutput {
161-
stream: RwStreamSink::new(mapped),
162+
stream: RwStreamSink::new(stream_sink),
162163
remote_key: remote.public_key,
163164
}
164165
))
165166
}
166167
}
167168

168-
fn map_err(err: io::Error) -> io::Error {
169-
debug!("error during plaintext handshake {:?}", err);
170-
io::Error::new(io::ErrorKind::InvalidData, err)
171-
}
172-
173169
pub struct PlainTextMiddleware<S> {
174170
inner: Framed<S, UviBytes<BytesMut>>,
175171
}
@@ -226,7 +222,7 @@ where
226222
S: AsyncRead + AsyncWrite + Unpin,
227223
{
228224
/// The plaintext stream.
229-
pub stream: RwStreamSink<futures::stream::MapErr<PlainTextMiddleware<S>, fn(io::Error) -> io::Error>>,
225+
pub stream: RwStreamSink<PlainTextMiddleware<S>>,
230226
/// The public key of the remote.
231227
pub remote_key: PublicKey,
232228
}

0 commit comments

Comments
 (0)