mirror of
https://github.com/signalapp/Signal-Server.git
synced 2026-12-02 11:26:53 +00:00
Check message type before deserializing source serviceId
This commit is contained in:
1 parent
e79eb9904d
commit
adb5b6a4ea
4 files changed
+92
-12
No files matched your search
+1
@@ -58,6 +58,7 @@ class PendingAcknowledgementTracker {
|
||||
void addUnacknowledgedEnvelope(final MessageProtos.Envelope envelope) {
|
||||
sentMessageCounter.incrementAndGet();
|
||||
final UUID messageGuid = UUIDUtil.fromByteString(envelope.getServerGuid());
|
||||
// If the envelope has a source, and it is not a server delivery receipt, it will be an ACI.
|
||||
final AciServiceIdentifier sourceId = envelope.hasSourceServiceId() && envelope.getType() != MessageProtos.Envelope.Type.SERVER_DELIVERY_RECEIPT
|
||||
? AciServiceIdentifier.fromByteString(envelope.getSourceServiceId())
|
||||
: null;
|
||||
|
||||
+6
-10
@@ -241,16 +241,12 @@ public class WebSocketConnection implements DisconnectionRequestListener {
|
||||
final ServiceIdentifier destinationServiceIdentifier =
|
||||
ServiceIdentifier.fromByteString(message.getDestinationServiceId());
|
||||
|
||||
@Nullable final AciServiceIdentifier sourceServiceIdentifier;
|
||||
final boolean shouldSendDeliveryReceipt;
|
||||
|
||||
if (message.hasSourceServiceId()) {
|
||||
sourceServiceIdentifier = AciServiceIdentifier.fromByteString(message.getSourceServiceId());
|
||||
shouldSendDeliveryReceipt = message.getType() != Envelope.Type.SERVER_DELIVERY_RECEIPT;
|
||||
} else {
|
||||
sourceServiceIdentifier = null;
|
||||
shouldSendDeliveryReceipt = false;
|
||||
}
|
||||
final boolean shouldSendDeliveryReceipt =
|
||||
message.hasSourceServiceId() && message.getType() != Envelope.Type.SERVER_DELIVERY_RECEIPT;
|
||||
// If the envelope has a source, and it is not a server delivery receipt, it will be an ACI.
|
||||
@Nullable final AciServiceIdentifier sourceServiceIdentifier = shouldSendDeliveryReceipt
|
||||
? AciServiceIdentifier.fromByteString(message.getSourceServiceId())
|
||||
: null;
|
||||
|
||||
final Timer.Sample sample = Timer.start();
|
||||
|
||||
|
||||
Reference in new issue
Block a user