mirror of
https://github.com/cmz0228/hysteria-dev.git
synced 2025-08-17 23:01:46 +00:00
feat(wip): udp rework client side
This commit is contained in:
@@ -111,9 +111,8 @@ type udpSessionManager struct {
|
||||
eventLogger udpEventLogger
|
||||
idleTimeout time.Duration
|
||||
|
||||
mutex sync.Mutex
|
||||
m map[uint32]*udpSessionEntry
|
||||
nextID uint32
|
||||
mutex sync.Mutex
|
||||
m map[uint32]*udpSessionEntry
|
||||
}
|
||||
|
||||
func newUDPSessionManager(io udpIO, eventLogger udpEventLogger, idleTimeout time.Duration) *udpSessionManager {
|
||||
@@ -212,3 +211,9 @@ func (m *udpSessionManager) feed(msg *protocol.UDPMessage) {
|
||||
// as some are temporary (e.g. invalid address)
|
||||
_, _ = entry.Feed(msg)
|
||||
}
|
||||
|
||||
func (m *udpSessionManager) Count() int {
|
||||
m.mutex.Lock()
|
||||
defer m.mutex.Unlock()
|
||||
return len(m.m)
|
||||
}
|
||||
|
Reference in New Issue
Block a user