Respond to CR.

pull/1/head
Matthew Chen 8 years ago
parent 862172072c
commit 78c4c00eac

@ -60,7 +60,8 @@ extern const NSUInteger kIdentityKeyLength;
- (nullable OWSRecipientIdentity *)untrustedIdentityForSendingToRecipientId:(NSString *)recipientId; - (nullable OWSRecipientIdentity *)untrustedIdentityForSendingToRecipientId:(NSString *)recipientId;
// This method can be called from any thread. // This method can be called from any thread.
- (void)processIncomingSyncMessage:(OWSSignalServiceProtosVerified *)verified; - (void)processIncomingSyncMessage:(OWSSignalServiceProtosVerified *)verified
transaction:(YapDatabaseReadWriteTransaction *)transaction;
- (BOOL)saveRemoteIdentity:(NSData *)identityKey recipientId:(NSString *)recipientId; - (BOOL)saveRemoteIdentity:(NSData *)identityKey recipientId:(NSString *)recipientId;

@ -683,7 +683,11 @@ NSString *const kNSNotificationName_IdentityStateDidChange = @"kNSNotificationNa
} }
- (void)processIncomingSyncMessage:(OWSSignalServiceProtosVerified *)verified - (void)processIncomingSyncMessage:(OWSSignalServiceProtosVerified *)verified
transaction:(YapDatabaseReadWriteTransaction *)transaction
{ {
OWSAssert(verified);
OWSAssert(transaction);
NSString *recipientId = verified.destination; NSString *recipientId = verified.destination;
if (recipientId.length < 1) { if (recipientId.length < 1) {
OWSFail(@"Verification state sync message missing recipientId."); OWSFail(@"Verification state sync message missing recipientId.");
@ -698,8 +702,6 @@ NSString *const kNSNotificationName_IdentityStateDidChange = @"kNSNotificationNa
} }
NSData *identityKey = [rawIdentityKey removeKeyType]; NSData *identityKey = [rawIdentityKey removeKeyType];
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
[self.dbConnection readWriteWithBlock:^(YapDatabaseReadWriteTransaction * transaction) {
switch (verified.state) { switch (verified.state) {
case OWSSignalServiceProtosVerifiedStateDefault: case OWSSignalServiceProtosVerifiedStateDefault:
[self tryToApplyVerificationStateFromSyncMessage:OWSVerificationStateDefault [self tryToApplyVerificationStateFromSyncMessage:OWSVerificationStateDefault
@ -721,9 +723,8 @@ NSString *const kNSNotificationName_IdentityStateDidChange = @"kNSNotificationNa
OWSVerificationStateToString(OWSVerificationStateNoLongerVerified)); OWSVerificationStateToString(OWSVerificationStateNoLongerVerified));
return; return;
} }
}];
[self fireIdentityStateChangeNotification]; [self fireIdentityStateChangeNotification];
});
} }
- (void)tryToApplyVerificationStateFromSyncMessage:(OWSVerificationState)verificationState - (void)tryToApplyVerificationStateFromSyncMessage:(OWSVerificationState)verificationState

@ -699,7 +699,7 @@ NS_ASSUME_NONNULL_BEGIN
transaction:transaction]; transaction:transaction];
} else if (syncMessage.hasVerified) { } else if (syncMessage.hasVerified) {
DDLogInfo(@"%@ Received verification state for %@", self.logTag, syncMessage.verified.destination); DDLogInfo(@"%@ Received verification state for %@", self.logTag, syncMessage.verified.destination);
[self.identityManager processIncomingSyncMessage:syncMessage.verified]; [self.identityManager processIncomingSyncMessage:syncMessage.verified transaction:transaction];
} else { } else {
DDLogWarn(@"%@ Ignoring unsupported sync message.", self.logTag); DDLogWarn(@"%@ Ignoring unsupported sync message.", self.logTag);
} }

Loading…
Cancel
Save