We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 9618f7e commit eea54beCopy full SHA for eea54be
graphql/websocket.go
@@ -45,11 +45,11 @@ const (
45
type webSocketClient struct {
46
Dialer Dialer
47
header http.Header
48
- endpoint string
49
conn WSConn
50
connParams map[string]interface{}
51
errChan chan error
52
subscriptions subscriptionMap
+ endpoint string
53
isClosing bool
54
sync.Mutex
55
}
@@ -105,9 +105,10 @@ func (w *webSocketClient) waitForConnAck() error {
105
106
func (w *webSocketClient) handleErr(err error) {
107
w.Lock()
108
- isClosing := w.isClosing
109
- w.Unlock()
110
- if !isClosing {
+ defer w.Unlock()
+ if !w.isClosing {
+ // Send while holding lock to prevent Close() from closing
111
+ // the channel between our check and our send
112
w.errChan <- err
113
114
0 commit comments