mirror of
https://github.com/refraction-networking/uquic.git
synced 2025-04-04 20:57:36 +03:00
add some more tests for the client multiplexer
This commit is contained in:
parent
0928e91e4d
commit
b682af20cf
5 changed files with 156 additions and 22 deletions
|
@ -15,9 +15,14 @@ import (
|
|||
|
||||
var (
|
||||
clientMuxerOnce sync.Once
|
||||
clientMuxer *clientMultiplexer
|
||||
clientMuxer multiplexer
|
||||
)
|
||||
|
||||
type multiplexer interface {
|
||||
AddConn(net.PacketConn) packetHandlerManager
|
||||
AddHandler(net.PacketConn, protocol.ConnectionID, packetHandler) error
|
||||
}
|
||||
|
||||
// The clientMultiplexer listens on multiple net.PacketConns and dispatches
|
||||
// incoming packets to the session handler.
|
||||
type clientMultiplexer struct {
|
||||
|
@ -29,7 +34,9 @@ type clientMultiplexer struct {
|
|||
logger utils.Logger
|
||||
}
|
||||
|
||||
func getClientMultiplexer() *clientMultiplexer {
|
||||
var _ multiplexer = &clientMultiplexer{}
|
||||
|
||||
func getClientMultiplexer() multiplexer {
|
||||
clientMuxerOnce.Do(func() {
|
||||
clientMuxer = &clientMultiplexer{
|
||||
conns: make(map[net.PacketConn]packetHandlerManager),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue