When all Streams are dropped / finished, the Connection was held open until the peer hangs up. Instead, the Connection should hang up once it knows that nothing more will be sent. To fix this, we notify the Connection when a stream is no longer referenced. On the Connection poll(), we check that there are no active, held, reset streams or any references to the Streams and transition to sending a GOAWAY if that is case. The specific behavior depends on if running as a client or server.
This commit is contained in:
committed by
Carl Lerche
parent
73b4c03b55
commit
0c59957d88
@@ -140,9 +140,9 @@ use proto::{self, Config, Prioritized};
|
||||
use bytes::{Buf, Bytes, IntoBuf};
|
||||
use futures::{self, Async, Future, Poll};
|
||||
use http::{Request, Response};
|
||||
use tokio_io::{AsyncRead, AsyncWrite};
|
||||
use std::{convert, fmt, mem};
|
||||
use std::time::Duration;
|
||||
use tokio_io::{AsyncRead, AsyncWrite};
|
||||
|
||||
/// In progress HTTP/2.0 connection handshake future.
|
||||
///
|
||||
@@ -424,6 +424,14 @@ where
|
||||
pub fn poll_close(&mut self) -> Poll<(), ::Error> {
|
||||
self.connection.poll().map_err(Into::into)
|
||||
}
|
||||
|
||||
/// Sets the connection to a GOAWAY state. Does not close connection immediately.
|
||||
///
|
||||
/// This closes the stream after sending a GOAWAY frame
|
||||
/// and flushing the codec. Must continue being polled to close connection.
|
||||
pub fn close_connection(&mut self) {
|
||||
self.connection.close_connection();
|
||||
}
|
||||
}
|
||||
|
||||
impl<T, B> futures::Stream for Connection<T, B>
|
||||
|
||||
Reference in New Issue
Block a user