Closed No-SilverBullet closed 4 months ago
@No-SilverBullet good job. Maybe u can also check the tcp write is thread safe or not. refer issue https://github.com/apache/dubbo-getty/issues/103
Should we use the packetLock in the session?
Based on this issue120 and document( https://pkg.go.dev/github.com/gorilla/websocket#hdr-Concurrency
), the writeMessage function in gorrila package is not concurrency safe, so a lock is added to prevent race conditions.
@No-SilverBullet good job. Maybe u can also check the tcp write is thread safe or not. refer issue #103
ok
Should we use the packetLock in the session?
Based on this issue120 and document( https://pkg.go.dev/github.com/gorilla/websocket#hdr-Concurrency
), the writeMessage function in gorrila package is not concurrency safe, so a lock is added to prevent race conditions.
What this PR does:
based on doc: https://pkg.go.dev/github.com/gorilla/websocket#hdr-Concurrency and https://github.com/apache/dubbo-getty/issues/120
1.add lock (sync.Mutex) in gettyWSConn struct
based on https://github.com/apache/dubbo-getty/issues/103
Fixes https://github.com/apache/dubbo-getty/issues/120, https://github.com/apache/dubbo-getty/issues/103
Special notes for your reviewer:
Does this PR introduce a user-facing change?: