From 36dfee6ea7deed70950e8e1b14f36595d237fe9c Mon Sep 17 00:00:00 2001 From: stammw Date: Mon, 9 Sep 2019 23:10:20 +0200 Subject: [PATCH] H3: let client close connection gracefully --- quinn-h3/src/client.rs | 4 ++++ quinn-h3/src/connection.rs | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/quinn-h3/src/client.rs b/quinn-h3/src/client.rs index 1d8781ca5..d1f8ad184 100644 --- a/quinn-h3/src/client.rs +++ b/quinn-h3/src/client.rs @@ -95,6 +95,10 @@ impl Connection { conn: self.0.clone(), } } + + pub fn close(self, error_code: u32, reason: &[u8]) { + self.0.quic.close(error_code.into(), reason); + } } pub struct Connecting { diff --git a/quinn-h3/src/connection.rs b/quinn-h3/src/connection.rs index 1d9693b89..3580d7cd4 100644 --- a/quinn-h3/src/connection.rs +++ b/quinn-h3/src/connection.rs @@ -33,7 +33,7 @@ impl Future for ConnectionDriver { fn poll(&mut self) -> Poll { match self.incoming.poll()? { - Async::Ready(None) => return Err(Error::peer("incoming requests closed")), + Async::Ready(None) => return Ok(Async::Ready(())), Async::Ready(Some(NewStream::Uni(_recv))) => { info!(self.log, "incoming uni stream ignored"); }