Avoid groupsync deadlock - pass in transaction

// FREEBIE
pull/1/head
Michael Kirk 8 years ago
parent 384d3b201f
commit 98fd15fae7

@ -1,12 +1,16 @@
// Copyright © 2016 Open Whisper Systems. All rights reserved.
//
// Copyright (c) 2017 Open Whisper Systems. All rights reserved.
//
#import "OWSOutgoingSyncMessage.h"
NS_ASSUME_NONNULL_BEGIN
@class YapDatabaseReadTransaction;
@interface OWSSyncGroupsMessage : OWSOutgoingSyncMessage
- (NSData *)buildPlainTextAttachmentData;
- (NSData *)buildPlainTextAttachmentDataWithTransaction:(YapDatabaseReadTransaction *)transaction;
@end

@ -40,7 +40,7 @@ NS_ASSUME_NONNULL_BEGIN
return syncMessageBuilder;
}
- (NSData *)buildPlainTextAttachmentData
- (NSData *)buildPlainTextAttachmentDataWithTransaction:(YapDatabaseReadTransaction *)transaction
{
// TODO use temp file stream to avoid loading everything into memory at once
// First though, we need to re-engineer our attachment process to accept streams (encrypting with stream,

@ -615,8 +615,8 @@ NS_ASSUME_NONNULL_BEGIN
}];
} else if (syncMessage.request.type == OWSSignalServiceProtosSyncMessageRequestTypeGroups) {
OWSSyncGroupsMessage *syncGroupsMessage = [[OWSSyncGroupsMessage alloc] init];
DataSource *dataSource =
[DataSourceValue dataSourceWithSyncMessage:[syncGroupsMessage buildPlainTextAttachmentData]];
DataSource *dataSource = [DataSourceValue
dataSourceWithSyncMessage:[syncGroupsMessage buildPlainTextAttachmentDataWithTransaction:transaction]];
[self.messageSender sendTemporaryAttachmentData:dataSource
contentType:OWSMimeTypeApplicationOctetStream
inMessage:syncGroupsMessage

Loading…
Cancel
Save