simplify the packetHandlerManager interface

This commit is contained in:
Marten Seemann 2019-11-03 09:01:17 +07:00
parent 9cbbdaa7b3
commit 36c77a56c9
2 changed files with 9 additions and 13 deletions

View file

@ -35,14 +35,10 @@ type unknownPacketHandler interface {
type packetHandlerManager interface {
io.Closer
Add(protocol.ConnectionID, packetHandler)
Retire(protocol.ConnectionID)
Remove(protocol.ConnectionID)
ReplaceWithClosed(protocol.ConnectionID, packetHandler)
AddResetToken([16]byte, packetHandler)
RemoveResetToken([16]byte)
GetStatelessResetToken(protocol.ConnectionID) [16]byte
SetServer(unknownPacketHandler)
CloseServer()
sessionRunner
}
type quicSession interface {
@ -57,14 +53,6 @@ type quicSession interface {
closeRemote(error)
}
type sessionRunner interface {
Retire(protocol.ConnectionID)
Remove(protocol.ConnectionID)
ReplaceWithClosed(protocol.ConnectionID, packetHandler)
AddResetToken([16]byte, packetHandler)
RemoveResetToken([16]byte)
}
// A Listener of QUIC
type baseServer struct {
mutex sync.Mutex

View file

@ -72,6 +72,14 @@ func (p *receivedPacket) Clone() *receivedPacket {
}
}
type sessionRunner interface {
Retire(protocol.ConnectionID)
Remove(protocol.ConnectionID)
ReplaceWithClosed(protocol.ConnectionID, packetHandler)
AddResetToken([16]byte, packetHandler)
RemoveResetToken([16]byte)
}
type handshakeRunner struct {
onReceivedParams func([]byte)
onError func(error)