Skip to content

Commit

Permalink
Revert key string change.
Browse files Browse the repository at this point in the history
  • Loading branch information
sbruens committed Jun 28, 2024
1 parent 8ec3640 commit 32f9df0
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions service/udp.go
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@ func (m *natmap) Get(key string) *natconn {
return m.keyConn[key]
}

func (m *natmap) set(clientAddr net.Addr, pc net.PacketConn, clientInfo ipinfo.IPInfo) *natconn {
func (m *natmap) set(key string, pc net.PacketConn, clientInfo ipinfo.IPInfo) *natconn {
entry := &natconn{
PacketConn: pc,
clientInfo: clientInfo,
Expand All @@ -326,7 +326,7 @@ func (m *natmap) set(clientAddr net.Addr, pc net.PacketConn, clientInfo ipinfo.I
m.Lock()
defer m.Unlock()

m.keyConn[clientAddr.String()] = entry
m.keyConn[key] = entry
return entry
}

Expand All @@ -343,7 +343,7 @@ func (m *natmap) del(key string) net.PacketConn {
}

func (m *natmap) Add(clientAddr net.Addr, clientConn net.PacketConn, cryptoKey *shadowsocks.EncryptionKey, targetConn net.PacketConn, clientInfo ipinfo.IPInfo, keyID string) *natconn {
entry := m.set(clientAddr, targetConn, clientInfo)
entry := m.set(clientAddr.String(), targetConn, clientInfo)

m.metrics.AddUDPNatEntry(clientAddr, keyID)
m.running.Add(1)
Expand Down

0 comments on commit 32f9df0

Please sign in to comment.