174bc082d1
- Use write lock (Lock) instead of read lock (RLock) in CloseOnIdle since it modifies the close channel, preventing a race with Close() that could panic on double-close of channel. - Buffer sniffingWebsocketFrame errc to capacity 2 and close both connections on first error to ensure the remaining copy goroutine unblocks and exits cleanly.