Cycle the socket after linking a new device.
This commit is contained in:
parent
c92f843530
commit
bebb8ecfd1
@ -169,6 +169,10 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
[self.linkedDevicesTableViewController expectMoreDevices];
|
||||
[self.navigationController popToViewController:self.linkedDevicesTableViewController animated:YES];
|
||||
|
||||
// The service implementation of the socket connection caches the linked device state,
|
||||
// so all sync message sends will fail on the socket until it is cycled.
|
||||
[TSSocketManager.sharedManager cycleSocket];
|
||||
});
|
||||
}
|
||||
failure:^(NSError *error) {
|
||||
|
||||
@ -41,6 +41,9 @@ typedef void (^TSSocketMessageFailure)(NSInteger statusCode, NSData *_Nullable r
|
||||
// This method can be called from any thread.
|
||||
+ (void)requestSocketOpen;
|
||||
|
||||
// This can be used to force the socket to close and re-open, if it is open.
|
||||
- (void)cycleSocket;
|
||||
|
||||
#pragma mark - Message Sending
|
||||
|
||||
+ (BOOL)canMakeRequests;
|
||||
|
||||
@ -800,6 +800,15 @@ NSString *const kNSNotification_SocketManagerStateDidChange = @"kNSNotification_
|
||||
}
|
||||
}
|
||||
|
||||
- (void)cycleSocket
|
||||
{
|
||||
OWSAssertIsOnMainThread();
|
||||
|
||||
[self closeWebSocket];
|
||||
|
||||
[self applyDesiredSocketState];
|
||||
}
|
||||
|
||||
- (void)handleSocketFailure
|
||||
{
|
||||
OWSAssertIsOnMainThread();
|
||||
|
||||
Loading…
Reference in New Issue
Block a user