diff --git a/protocols/request-response/CHANGELOG.md b/protocols/request-response/CHANGELOG.md index 84e59dad..b4d45ca4 100644 --- a/protocols/request-response/CHANGELOG.md +++ b/protocols/request-response/CHANGELOG.md @@ -1,3 +1,11 @@ +# 0.1.1 + +- Always properly `close()` the substream after sending requests and +responses in the `InboundUpgrade` and `OutboundUpgrade`. Otherwise this is +left to `RequestResponseCodec::write_request` and `RequestResponseCodec::write_response`, +which can be a pitfall and lead to subtle problems (see e.g. +https://github.com/libp2p/rust-libp2p/pull/1606). + # 0.1.0 - Initial release. diff --git a/protocols/request-response/Cargo.toml b/protocols/request-response/Cargo.toml index ae4df0a3..79ee83d6 100644 --- a/protocols/request-response/Cargo.toml +++ b/protocols/request-response/Cargo.toml @@ -2,7 +2,7 @@ name = "libp2p-request-response" edition = "2018" description = "Generic Request/Response Protocols" -version = "0.1.0" +version = "0.1.1" authors = ["Parity Technologies "] license = "MIT" repository = "https://github.com/libp2p/rust-libp2p" diff --git a/protocols/request-response/src/handler/protocol.rs b/protocols/request-response/src/handler/protocol.rs index c0dcdaf9..6373e90d 100644 --- a/protocols/request-response/src/handler/protocol.rs +++ b/protocols/request-response/src/handler/protocol.rs @@ -113,6 +113,7 @@ where write.await?; } } + io.close().await?; Ok(()) }.boxed() } @@ -156,10 +157,10 @@ where async move { let write = self.codec.write_request(&protocol, &mut io, self.request); write.await?; + io.close().await?; let read = self.codec.read_response(&protocol, &mut io); let response = read.await?; Ok(response) }.boxed() } } -