]> nmode's Git Repositories - signal-cli/blobdiff - src/main/java/org/asamk/signal/commands/JsonRpcDispatcherCommand.java
Only handle jsonRpc requests, after receive thread has caught up with old messages
[signal-cli] / src / main / java / org / asamk / signal / commands / JsonRpcDispatcherCommand.java
index 16d0cf717621e03aa50f9655423cfcd56579f8a5..d0e4dfec353325954d640e20457c968e8a8c470f 100644 (file)
@@ -75,6 +75,16 @@ public class JsonRpcDispatcherCommand implements LocalCommand {
                 objectMapper.valueToTree(s),
                 null)), m, ignoreAttachments);
 
+        // Maybe this should be handled inside the Manager
+        while (!m.hasCaughtUpWithOldMessages()) {
+            try {
+                synchronized (m) {
+                    m.wait();
+                }
+            } catch (InterruptedException ignored) {
+            }
+        }
+
         final BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
 
         final var jsonRpcReader = new JsonRpcReader(jsonRpcSender, () -> {