mirror of
https://github.com/fluencelabs/rust-libp2p
synced 2025-04-25 11:02:12 +00:00
[request-response] Close substream after writing request/response. (#1660)
* Close substream after writing request/response. * Update protocols/request-response/src/handler/protocol.rs Co-authored-by: Thomas Eizinger <thomas@eizinger.io> Co-authored-by: Thomas Eizinger <thomas@eizinger.io>
This commit is contained in:
parent
e61ccd22df
commit
c8b426005f
@ -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.
|
||||
|
@ -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 <admin@parity.io>"]
|
||||
license = "MIT"
|
||||
repository = "https://github.com/libp2p/rust-libp2p"
|
||||
|
@ -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()
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user