Skip to content

Commit

Permalink
Temp fix for a crash faced by client using proxy connection: #1437
Browse files Browse the repository at this point in the history
Explanation:
`ARTSRProxyConnect` object can potentially generate a proxy connection error even after initial success (or more than one error in a raw), which can depend on what proxy type is used, which will create a race condition: `self->_proxyConnect = nil;` deallocates `ARTSRProxyConnect` object on a `_workQueue`, and a subsequent call to `_failWithError:`  on a `io.ably.socketrocket.NetworkThread` inside `ARTSRProxyConnect` will cause crash when it'll try to access `self`.
  • Loading branch information
maratal committed Sep 5, 2022
1 parent 5f61e2a commit c2ed307
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions SocketRocket/SocketRocket/ARTSRWebSocket.m
Original file line number Diff line number Diff line change
Expand Up @@ -362,9 +362,9 @@ - (void)_connectionDoneWithError:(NSError *)error readStream:(NSInputStream *)re
}
// Schedule to run on a work queue, to make sure we don't run this inline and deallocate `self` inside `ARTSRProxyConnect`.
// TODO: (nlutsenko) Find a better structure for this, maybe Bolts Tasks?
dispatch_async(_workQueue, ^{
self->_proxyConnect = nil;
});
// dispatch_async(_workQueue, ^{
// self->_proxyConnect = nil;
// });
}

- (BOOL)_checkHandshake:(CFHTTPMessageRef)httpMessage;
Expand Down

0 comments on commit c2ed307

Please sign in to comment.