Improved socket fallback for attachment v2

This commit is contained in:
Greyson Parrelli 2019-06-14 14:47:12 -04:00
parent 1aebce8d6e
commit eed1625965

View File

@ -332,12 +332,18 @@ public class SignalServiceMessageSender {
new AttachmentCipherOutputStreamFactory(attachmentKey),
attachment.getListener());
AttachmentUploadAttributes uploadAttributes;
AttachmentUploadAttributes uploadAttributes = null;
if (pipe.get().isPresent()) {
Log.d(TAG, "Using pipe to retrieve attachment upload attributes...");
uploadAttributes = pipe.get().get().getAttachmentUploadAttributes();
} else {
try {
uploadAttributes = pipe.get().get().getAttachmentUploadAttributes();
} catch (IOException e) {
Log.w(TAG, "Failed to retrieve attachment upload attributes using pipe. Falling back...");
}
}
if (uploadAttributes == null) {
Log.d(TAG, "Not using pipe to retrieve attachment upload attributes...");
uploadAttributes = socket.getAttachmentUploadAttributes();
}