Skip to content

Commit edb1d76

Browse files
authored
Fix shadowsocks2022 concurrent map read and map write (#3653)
Thanks dyhkwong!
1 parent 126e70b commit edb1d76

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

proxy/shadowsocks2022/client_session.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -269,9 +269,9 @@ func (c *ClientUDPSessionConn) ReadFrom(p []byte) (n int, addr net.Addr, err err
269269
rxReplayDetector: replaydetector.New(1024, ^uint64(0)),
270270
}
271271
c.trackedServerSessionID[string(resp.SessionID[:])] = state
272-
c.parent.locker.RLock()
272+
c.parent.locker.Lock()
273273
c.parent.sessionMapAlias[string(resp.SessionID[:])] = string(resp.ClientSessionID[:])
274-
c.parent.locker.RUnlock()
274+
c.parent.locker.Unlock()
275275
trackedState = state
276276
} else {
277277
trackedState = trackedStateReceived

0 commit comments

Comments
 (0)