diff options
author | Alex Auvolat <alex@adnab.me> | 2022-07-22 13:32:08 +0200 |
---|---|---|
committer | Alex Auvolat <alex@adnab.me> | 2022-07-22 13:32:08 +0200 |
commit | b9df442f035e6648e80adf8f9bf86b4943508ae5 (patch) | |
tree | 7c1c7179cb2c06f944476e6d9518ee88f37752a3 /src/endpoint.rs | |
parent | 50627c206043edf5ce8755893944a6f17a54fb85 (diff) | |
download | netapp-b9df442f035e6648e80adf8f9bf86b4943508ae5.tar.gz netapp-b9df442f035e6648e80adf8f9bf86b4943508ae5.zip |
Small optimization
Diffstat (limited to 'src/endpoint.rs')
-rw-r--r-- | src/endpoint.rs | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/endpoint.rs b/src/endpoint.rs index 31500aa..588f7e3 100644 --- a/src/endpoint.rs +++ b/src/endpoint.rs @@ -52,7 +52,10 @@ where T: EndpointHandler<M>, M: Message + 'static, { - async fn handle(self: &Arc<Self>, m: Req<M>, from: NodeID) -> Resp<M> { + async fn handle(self: &Arc<Self>, mut m: Req<M>, from: NodeID) -> Resp<M> { + // Immediately drop stream to avoid backpressure if a stream was sent + // (this will make all data sent to the stream be ignored immediately) + drop(m.take_stream()); Resp::new(EndpointHandler::handle(self, m.msg(), from).await) } } |