Compare commits

...

5 commits

2 changed files with 85 additions and 21 deletions

View file

@ -1,26 +1,26 @@
{
"aarch64-unknown-linux-gnu": {
"jar": "23fff858bf4bcc5c54025985e7ebfff4ef962b8fbc53d6b40643859fee7baebc",
"module": "8ce69b13baa2e55f18d8697eaac3b31bb368757e69db253368837efcb1336efc"
"jar": "0655a334d0cb9281536578c374d1a370c6153164fbba3719320e6a731b4db00e",
"module": "608bdadffc100797831e87d71e1e050e61e042db9032acca53f6357491c0ab2d"
},
"arm-unknown-linux-gnueabi": {
"jar": "fa434c0eb0382d760daf0dfa33d7608165a163a7ef7ba5d032fbaa0ed702a0e0",
"module": "92192e932f76f916b768450c564a939e419c32bf3498dd41d7f940cc1a91ef88"
"jar": "045603c735f6856eef7184c3480e3d9be6d513dc547a6583b014e74646da6826",
"module": "77e4f0f516577de0511f9b631b21820538d10cad0fef87f8918df4122c8ba73b"
},
"arm-unknown-linux-gnueabihf": {
"jar": "c533bb67e0f5ecb1c26c2e271a5bb172523336bdfa38bcea11d8d34ec5c8d709",
"module": "299801969962e677348894b4bd9d7efc1faea342824d09846c69f239adf8a48a"
"jar": "5cd241208f489ba051d7e215abe5a32e31daf3b067ead5845b9b5640c61629ad",
"module": "6d3b60d27fe87d9b3c7738c0df873967f205bf01839ce2f79cfcbcb1638851db"
},
"armv7-unknown-linux-gnueabihf": {
"jar": "34396d42050b5f8d7ed8da65d14903c47ddc8a0730e8153828cd87e2353a23e0",
"module": "7d48dae9a26b9ffc218211407d54849d24b79a774eacd5d066e71b63d88f09ba"
"jar": "0d26c8aa61baedff7cb3a487493469b9b1858f4e2e8c4836994deb566c1c8244",
"module": "b5753c4c91f36eb0495c3e9505d9826a776f3697523b0e9e81544d30904b5a37"
},
"x86_64-unknown-linux-gnu": {
"jar": "f4938212a9be733cd6fbfe1910b5fcc7b3a0e75e7065f8c8e1abf09c69f28a60",
"module": "a98dea88331ad9861f3b3b0a99f93e5fdab04b41784e74234abca9bebf63ad77"
"jar": "3a2516fcc468f462790648df25061386e2b3b9530f60aeed2b49b3bd0e9f8412",
"module": "98d297a13d9ac675d42982c864c2ad13d5574a97fe3afc5b8c75abaf61740189"
},
"x86_64-apple-darwin": {
"jar": "690745c6d40bbddbe1632c52942746428eafa6fdc02423f7c3d1d7ced5267777",
"module": "d561f31ef5d232245d6f5f717264c6b44f7cffcd37b8c58ac65b276ff5257215"
"module": "a596556990b0d0bad2da402cf2c6f0196ebd7f86e18477d6564c8b848be4ea93"
}
}

View file

@ -1,18 +1,22 @@
From dfcc82ab4b4f4d3c18e210ba724ce761deaa6e91 Mon Sep 17 00:00:00 2001
From b58a6a7defbc7fa876bb980ee45c5cbbe49ed40e Mon Sep 17 00:00:00 2001
From: signald <nobody@signald.org>
Date: Thu, 16 Jun 2022 13:04:00 -0700
Subject: [PATCH] update build files
Subject: [PATCH] update build files and provide a way for the websocket
receive callback to indicate the message was not saved
---
build.gradle | 15 ++-------------
dependencies.gradle | 3 +--
gradle/verification-metadata.xml | 13 ++++++++-----
service/build.gradle | 19 +++++++++----------
settings.gradle | 1 -
5 files changed, 20 insertions(+), 31 deletions(-)
build.gradle | 17 +++--------------
dependencies.gradle | 3 +--
gradle/verification-metadata.xml | 13 ++++++++-----
service/build.gradle | 19 +++++++++----------
.../signalservice/api/NotSavedException.java | 4 ++++
.../signalservice/api/SignalWebSocket.java | 16 ++++++++++++----
settings.gradle | 1 -
7 files changed, 37 insertions(+), 36 deletions(-)
create mode 100644 service/src/main/java/org/whispersystems/signalservice/api/NotSavedException.java
diff --git a/build.gradle b/build.gradle
index 2498bfcb..9a69ac82 100644
index 2498bfcb..965084e6 100644
--- a/build.gradle
+++ b/build.gradle
@@ -9,11 +9,8 @@ buildscript {
@ -42,8 +46,9 @@ index 2498bfcb..9a69ac82 100644
-}
subprojects {
ext.lib_signal_service_version_number = "2.15.3_unofficial_50"
- ext.lib_signal_service_version_number = "2.15.3_unofficial_50"
- ext.lib_signal_service_group_info = "com.github.turasa"
+ ext.lib_signal_service_version_number = "2.15.3_unofficial_50_signald_1"
+ ext.lib_signal_service_group_info = "org.signald"
if (JavaVersion.current().isJava8Compatible()) {
@ -139,6 +144,65 @@ index ae4df43a..4b0240d8 100644
- required { isReleaseBuild() && gradle.taskGraph.hasTask("uploadArchives") }
- sign publishing.publications.mavenJava
-}
diff --git a/service/src/main/java/org/whispersystems/signalservice/api/NotSavedException.java b/service/src/main/java/org/whispersystems/signalservice/api/NotSavedException.java
new file mode 100644
index 00000000..05d77d1f
--- /dev/null
+++ b/service/src/main/java/org/whispersystems/signalservice/api/NotSavedException.java
@@ -0,0 +1,4 @@
+package org.whispersystems.signalservice.api;
+
+public class NotSavedException extends Exception {
+}
diff --git a/service/src/main/java/org/whispersystems/signalservice/api/SignalWebSocket.java b/service/src/main/java/org/whispersystems/signalservice/api/SignalWebSocket.java
index 5a98f3c4..6ae9d72e 100644
--- a/service/src/main/java/org/whispersystems/signalservice/api/SignalWebSocket.java
+++ b/service/src/main/java/org/whispersystems/signalservice/api/SignalWebSocket.java
@@ -238,11 +238,12 @@ public final class SignalWebSocket {
*/
@SuppressWarnings("DuplicateThrows")
public Optional<SignalServiceEnvelope> readOrEmpty(long timeout, MessageReceivedCallback callback)
- throws TimeoutException, WebSocketUnavailableException, IOException
+ throws TimeoutException, WebSocketUnavailableException, IOException, NotSavedException
{
while (true) {
WebSocketRequestMessage request = getWebSocket().readRequest(timeout);
WebSocketResponseMessage response = createWebSocketResponse(request);
+ boolean sendResponse = true; // indicates the acknowledgement should be sent to the server
try {
if (isSignalServiceEnvelope(request)) {
Optional<String> timestampHeader = findHeader(request);
@@ -258,13 +259,20 @@ public final class SignalWebSocket {
SignalServiceEnvelope envelope = new SignalServiceEnvelope(request.getBody().toByteArray(), timestamp);
- callback.onMessage(envelope);
+ try {
+ callback.onMessage(envelope);
+ } catch (NotSavedException e) {
+ sendResponse = false;
+ throw e;
+ }
return Optional.of(envelope);
} else if (isSocketEmptyRequest(request)) {
return Optional.empty();
}
} finally {
- getWebSocket().sendResponse(response);
+ if(sendResponse) {
+ getWebSocket().sendResponse(response);
+ }
}
}
}
@@ -315,6 +323,6 @@ public final class SignalWebSocket {
* received.
*/
public interface MessageReceivedCallback {
- void onMessage(SignalServiceEnvelope envelope);
+ void onMessage(SignalServiceEnvelope envelope) throws NotSavedException;
}
}
diff --git a/settings.gradle b/settings.gradle
index 8861c008..8dd03423 100644
--- a/settings.gradle