feat(wip): udp rework client side

This commit is contained in:
Toby
2023-07-24 16:32:25 -07:00
parent f142a24047
commit cbedb27f0f
7 changed files with 391 additions and 391 deletions

View File

@@ -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)
}