From db96af2609a75284c5608cf592c3d4ce4b28ae0b Mon Sep 17 00:00:00 2001 From: Alex Auvolat Date: Tue, 13 Sep 2022 12:05:42 +0200 Subject: Add comment on cancellation --- src/message.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/message.rs b/src/message.rs index cc816c6..b12da32 100644 --- a/src/message.rs +++ b/src/message.rs @@ -499,6 +499,11 @@ impl RespEnc { let msg_len = reader.read_u32().await?; let msg = reader.read_exact(msg_len as usize).await?; + // Check whether the response stream still has data or not. + // If no more data is coming, this will defuse the request canceller. + // If we didn't do this, and the client doesn't try to read from the stream, + // the request canceller doesn't know that we read everything and + // sends a cancellation message to the server (which they don't care about). reader.fill_buffer().await; Ok(Self { -- cgit v1.2.3