njones / socketio

A Modern SocketIO library for go
MIT License
60 stars 9 forks source link

Fix data race conditions all server versions #46

Closed njones closed 1 year ago

njones commented 1 year ago

Fix Data Race Conditions in all Server Versions

When the tests for websockets were added, it exposed a Data Race that could happen when using the inSocketV(x) data structures. A RWMutex was added to guard access around the fields that could cause trouble. Also the tests were updated to increment counters using atomic to prevent race conditions within the test code. There needed to be atomic access around the interval duration in the sessions management code for EIO transports. This is a wrapper around int64 atomic code.