-
-
Notifications
You must be signed in to change notification settings - Fork 315
Open
Description
I am having some issue with tunneling TCP using h2, it aborts the connection after the server (usually speedtest servers) resets the connection and h2 trying to send_open()
.
Not sure if this should be tolerated by h2 or to be handled by my code. I tried to do an early return with a Closed
state and it seems to fix my problem.
pub fn send_open(&mut self, eos: bool) -> Result<(), UserError> {
let local = Streaming;
if matches!(self.inner, Inner::Closed(_)) {
return Ok(());
}
Lines 91 to 129 in 77be664
pub fn send_open(&mut self, eos: bool) -> Result<(), UserError> { | |
let local = Streaming; | |
self.inner = match self.inner { | |
Idle => { | |
if eos { | |
HalfClosedLocal(AwaitingHeaders) | |
} else { | |
Open { | |
local, | |
remote: AwaitingHeaders, | |
} | |
} | |
} | |
Open { | |
local: AwaitingHeaders, | |
remote, | |
} => { | |
if eos { | |
HalfClosedLocal(remote) | |
} else { | |
Open { local, remote } | |
} | |
} | |
HalfClosedRemote(AwaitingHeaders) | ReservedLocal => { | |
if eos { | |
Closed(Cause::EndStream) | |
} else { | |
HalfClosedRemote(local) | |
} | |
} | |
_ => { | |
// All other transitions result in a protocol error | |
return Err(UserError::UnexpectedFrameType); | |
} | |
}; | |
Ok(()) | |
} |
Any suggestions on a proper workaround?
Metadata
Metadata
Assignees
Labels
No labels