Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@

- Update individual crates.
- `libp2p-relay`
- `libp2p-tcp`

## Version 0.42.0 [2022-01-27]

Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ smallvec = "1.6.1"
libp2p-deflate = { version = "0.31.0", path = "transports/deflate", optional = true }
libp2p-dns = { version = "0.31.0", path = "transports/dns", optional = true, default-features = false }
libp2p-mdns = { version = "0.34.0", path = "protocols/mdns", optional = true }
libp2p-tcp = { version = "0.31.0", path = "transports/tcp", default-features = false, optional = true }
libp2p-tcp = { version = "0.31.1", path = "transports/tcp", default-features = false, optional = true }
libp2p-websocket = { version = "0.33.0", path = "transports/websocket", optional = true }

[dev-dependencies]
Expand Down
4 changes: 4 additions & 0 deletions transports/tcp/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# 0.31.1 [unreleased]

- Call `TcpSocket::take_error` to report connection establishment errors early.

# 0.31.0 [2022-01-27]

- Update dependencies.
Expand Down
2 changes: 1 addition & 1 deletion transports/tcp/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name = "libp2p-tcp"
edition = "2021"
rust-version = "1.56.1"
description = "TCP/IP transport protocol for libp2p"
version = "0.31.0"
version = "0.31.1"
authors = ["Parity Technologies <admin@parity.io>"]
license = "MIT"
repository = "https://github.com/libp2p/rust-libp2p"
Expand Down
2 changes: 2 additions & 0 deletions transports/tcp/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -852,6 +852,8 @@ mod tests {
panic!("No TCP port in address: {}", a)
}
ready_tx.send(a).await.ok();
}
ListenerEvent::Upgrade { .. } => {
return;
}
_ => {}
Expand Down
11 changes: 10 additions & 1 deletion transports/tcp/src/provider/async_io.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,18 @@ impl Provider for Tcp {

fn new_stream(s: net::TcpStream) -> BoxFuture<'static, io::Result<Self::Stream>> {
async move {
// Taken from [`Async::connect`].

let stream = Async::new(s)?;

// The stream becomes writable when connected.
stream.writable().await?;
Ok(stream)

// Check if there was an error while connecting.
match stream.get_ref().take_error()? {
None => Ok(stream),
Some(err) => Err(err),
}
}
.boxed()
}
Expand Down