Merge branch 'charlesmchen/socketVsNewLinkedDevice'

pull/1/head
Matthew Chen 7 years ago
commit e27e45e661

@ -169,6 +169,10 @@ NS_ASSUME_NONNULL_BEGIN
dispatch_async(dispatch_get_main_queue(), ^{ dispatch_async(dispatch_get_main_queue(), ^{
[self.linkedDevicesTableViewController expectMoreDevices]; [self.linkedDevicesTableViewController expectMoreDevices];
[self.navigationController popToViewController:self.linkedDevicesTableViewController animated:YES]; [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) { failure:^(NSError *error) {

@ -41,6 +41,9 @@ typedef void (^TSSocketMessageFailure)(NSInteger statusCode, NSData *_Nullable r
// This method can be called from any thread. // This method can be called from any thread.
+ (void)requestSocketOpen; + (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 #pragma mark - Message Sending
+ (BOOL)canMakeRequests; + (BOOL)canMakeRequests;

@ -800,6 +800,15 @@ NSString *const kNSNotification_SocketManagerStateDidChange = @"kNSNotification_
} }
} }
- (void)cycleSocket
{
OWSAssertIsOnMainThread();
[self closeWebSocket];
[self applyDesiredSocketState];
}
- (void)handleSocketFailure - (void)handleSocketFailure
{ {
OWSAssertIsOnMainThread(); OWSAssertIsOnMainThread();

Loading…
Cancel
Save