implement receiving of Public Resets for the client

When a Public Reset is received, the client validates if it was sent
from the correct remote address and if the connection ID matches. When a
valid Public Reset is received, the connection is closed immediately.
This commit is contained in:
Marten Seemann
2017-07-11 20:12:12 +07:00
parent c80bd6ff2c
commit 0867352b26
4 changed files with 65 additions and 3 deletions

View File

@@ -23,6 +23,7 @@ type mockSession struct {
packetCount int
closed bool
closeReason error
closedRemote bool
stopRunLoop chan struct{} // run returns as soon as this channel receives a value
handshakeChan chan handshakeEvent
handshakeComplete chan error // for WaitUntilHandshakeComplete
@@ -51,6 +52,12 @@ func (s *mockSession) Close(e error) error {
close(s.stopRunLoop)
return nil
}
func (s *mockSession) closeRemote(e error) {
s.closeReason = e
s.closed = true
s.closedRemote = true
close(s.stopRunLoop)
}
func (s *mockSession) AcceptStream() (Stream, error) {
panic("not implemented")
}