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
@@ -63,6 +63,7 @@ impl Dyn {
|
||||
/// Returns true if the remote peer can initiate a stream with the given ID.
|
||||
pub fn ensure_can_open(&self, id: StreamId) -> Result<(), RecvError> {
|
||||
if !self.is_server() {
|
||||
trace!("Cannot open stream {:?} - not server, PROTOCOL_ERROR", id);
|
||||
// Remote is a server and cannot open streams. PushPromise is
|
||||
// registered by reserving, so does not go through this path.
|
||||
return Err(RecvError::Connection(Reason::PROTOCOL_ERROR));
|
||||
@@ -70,6 +71,7 @@ impl Dyn {
|
||||
|
||||
// Ensure that the ID is a valid server initiated ID
|
||||
if !id.is_client_initiated() {
|
||||
trace!("Cannot open stream {:?} - not client initiated, PROTOCOL_ERROR", id);
|
||||
return Err(RecvError::Connection(Reason::PROTOCOL_ERROR));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user