Improve logging around group sends.

This commit is contained in:
Greyson Parrelli 2020-05-26 15:47:28 -04:00
parent 6fa2a0f411
commit d4cdcbe54f
2 changed files with 13 additions and 8 deletions

View File

@ -24,6 +24,7 @@ import org.thoughtcrime.securesms.dependencies.ApplicationDependencies;
import org.thoughtcrime.securesms.groups.GroupId;
import org.thoughtcrime.securesms.jobmanager.Data;
import org.thoughtcrime.securesms.jobmanager.Job;
import org.thoughtcrime.securesms.jobmanager.JobLogger;
import org.thoughtcrime.securesms.jobmanager.JobManager;
import org.thoughtcrime.securesms.jobmanager.impl.NetworkConstraint;
import org.thoughtcrime.securesms.logging.Log;
@ -171,6 +172,8 @@ public class PushGroupSendJob extends PushSendJob {
else target = getGroupMessageRecipients(groupRecipient.requireGroupId(), messageId);
List<SendMessageResult> results = deliver(message, groupRecipient, target);
Log.i(TAG, JobLogger.format(this, "Finished send."));
List<NetworkFailure> networkFailures = Stream.of(results).filter(SendMessageResult::isNetworkFailure).map(result -> new NetworkFailure(Recipient.externalPush(context, result.getAddress()).getId())).toList();
List<IdentityKeyMismatch> identityMismatches = Stream.of(results).filter(result -> result.getIdentityFailure() != null).map(result -> new IdentityKeyMismatch(Recipient.externalPush(context, result.getAddress()).getId(), result.getIdentityFailure().getIdentityKey())).toList();
Set<RecipientId> successIds = Stream.of(results).filter(result -> result.getSuccess() != null).map(SendMessageResult::getAddress).map(a -> Recipient.externalPush(context, a).getId()).collect(Collectors.toSet());
@ -301,6 +304,7 @@ public class PushGroupSendJob extends PushSendJob {
.asGroupMessage(group)
.build();
Log.i(TAG, JobLogger.format(this, "Beginning update send."));
return messageSender.sendMessage(addresses, unidentifiedAccess, isRecipientUpdate, groupDataMessage);
}
} else {
@ -321,6 +325,7 @@ public class PushGroupSendJob extends PushSendJob {
.withPreviews(previews)
.build();
Log.i(TAG, JobLogger.format(this, "Beginning message send."));
return messageSender.sendMessage(addresses, unidentifiedAccess, isRecipientUpdate, groupMessage);
}
}

View File

@ -1228,25 +1228,25 @@ public class SignalServiceMessageSender {
if (pipe.isPresent() && !unidentifiedAccess.isPresent()) {
try {
Log.w(TAG, "Transmitting over pipe...");
Log.i(TAG, "[sendMessage] Transmitting over pipe...");
SendMessageResponse response = pipe.get().send(messages, Optional.<UnidentifiedAccess>absent());
return SendMessageResult.success(recipient, false, response.getNeedsSync() || isMultiDevice.get());
} catch (IOException e) {
Log.w(TAG, e);
Log.w(TAG, "Falling back to new connection...");
Log.w(TAG, "[sendMessage] Falling back to new connection...");
}
} else if (unidentifiedPipe.isPresent() && unidentifiedAccess.isPresent()) {
try {
Log.w(TAG, "Transmitting over unidentified pipe...");
Log.i(TAG, "[sendMessage] Transmitting over unidentified pipe...");
SendMessageResponse response = unidentifiedPipe.get().send(messages, unidentifiedAccess);
return SendMessageResult.success(recipient, true, response.getNeedsSync() || isMultiDevice.get());
} catch (IOException e) {
Log.w(TAG, e);
Log.w(TAG, "Falling back to new connection...");
Log.w(TAG, "[sendMessage] Falling back to new connection...");
}
}
Log.w(TAG, "Not transmitting over pipe...");
Log.w(TAG, "[sendMessage] Not transmitting over pipe...");
SendMessageResponse response = socket.sendMessage(messages, unidentifiedAccess);
return SendMessageResult.success(recipient, unidentifiedAccess.isPresent(), response.getNeedsSync() || isMultiDevice.get());
@ -1282,10 +1282,10 @@ public class SignalServiceMessageSender {
for (SignalServiceAttachment attachment : attachments.get()) {
if (attachment.isStream()) {
Log.w(TAG, "Found attachment, creating pointer...");
Log.i(TAG, "Found attachment, creating pointer...");
pointers.add(createAttachmentPointer(attachment.asStream()));
} else if (attachment.isPointer()) {
Log.w(TAG, "Including existing attachment pointer...");
Log.i(TAG, "Including existing attachment pointer...");
pointers.add(createAttachmentPointer(attachment.asPointer()));
}
}