Skip to content

Commit 0b42c94

Browse files
gh-action-runnergh-action-runner
authored andcommitted
Squashed 'apollo-ios/' changes from d3ed72bd..0adf0250
0adf0250 fix: Assign websocket callback queue before connecting (#529) git-subtree-dir: apollo-ios git-subtree-split: 0adf0250e7f363345117766f3689e4c3e669c910
1 parent 9091023 commit 0b42c94

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

Sources/ApolloWebSocket/WebSocketTransport.swift

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,10 +167,14 @@ public class WebSocketTransport {
167167
self.addApolloClientHeaders(to: &self.websocket.request)
168168

169169
self.websocket.delegate = self
170+
// Keep the assignment of the callback queue before attempting to connect. There is the
171+
// potential of a data race if the connection fails early and the disconnect logic reads
172+
// the callback queue while it's being set.
173+
self.websocket.callbackQueue = processingQueue
174+
170175
if config.connectOnInit {
171176
self.websocket.connect()
172177
}
173-
self.websocket.callbackQueue = processingQueue
174178
}
175179

176180
public func isConnected() -> Bool {

0 commit comments

Comments
 (0)