go-socket.io
go-socket.io copied to clipboard
Why use sync.RWMutex in connection handle?
trafficstars
type session struct {
params base.ConnParameters
manager *manager
closeOnce sync.Once
context interface{}
upgradeLocker sync.RWMutex
transport string
conn base.Conn
}
I used conn.Emit("xx", "123") but this hang at the
func (w *writer) Write(p []byte) (int, error) {
w.locker.Lock()
defer w.locker.Unlock()
return w.WriteCloser.Write(p)
}
but when i next call the conn.Emit(), the last emit result will flush to the client, and this emit still hang at the lock。
I remove the lock code, this will be run fine
@HelloFy Hi Please send some more example code. If you want change some code, send new PR