]> nmode's Git Repositories - signal-cli/blobdiff - lib/src/main/java/org/asamk/signal/manager/Manager.java
Implement jsonRpc command
[signal-cli] / lib / src / main / java / org / asamk / signal / manager / Manager.java
index ef0b404b98ef38d0af3b0df770fcf3f0828c61ff..98b02c7f4e3cd45af04eaa06642e7bb85e06f415 100644 (file)
@@ -2028,6 +2028,9 @@ public class Manager implements Closeable {
             try {
                 action.execute(this);
             } catch (Throwable e) {
+                if (e instanceof AssertionError && e.getCause() instanceof InterruptedException) {
+                    Thread.currentThread().interrupt();
+                }
                 logger.warn("Message action failed.", e);
             }
         }
@@ -2074,7 +2077,7 @@ public class Manager implements Closeable {
             boolean returnOnTimeout,
             boolean ignoreAttachments,
             ReceiveMessageHandler handler
-    ) throws IOException {
+    ) throws IOException, InterruptedException {
         retryFailedReceivedMessages(handler, ignoreAttachments);
 
         Set<HandleAction> queuedActions = null;
@@ -2110,6 +2113,9 @@ public class Manager implements Closeable {
                             try {
                                 action.execute(this);
                             } catch (Throwable e) {
+                                if (e instanceof AssertionError && e.getCause() instanceof InterruptedException) {
+                                    Thread.currentThread().interrupt();
+                                }
                                 logger.warn("Message action failed.", e);
                             }
                         }
@@ -2120,6 +2126,12 @@ public class Manager implements Closeable {
                     // Continue to wait another timeout for new messages
                     continue;
                 }
+            } catch (AssertionError e) {
+                if (e.getCause() instanceof InterruptedException) {
+                    throw (InterruptedException) e.getCause();
+                } else {
+                    throw e;
+                }
             } catch (TimeoutException e) {
                 if (returnOnTimeout) return;
                 continue;
@@ -2153,6 +2165,9 @@ public class Manager implements Closeable {
                         try {
                             action.execute(this);
                         } catch (Throwable e) {
+                            if (e instanceof AssertionError && e.getCause() instanceof InterruptedException) {
+                                Thread.currentThread().interrupt();
+                            }
                             logger.warn("Message action failed.", e);
                         }
                     }
@@ -2549,6 +2564,9 @@ public class Manager implements Closeable {
             avatarStore.storeProfileAvatar(address,
                     outputStream -> retrieveProfileAvatar(avatarPath, profileKey, outputStream));
         } catch (Throwable e) {
+            if (e instanceof AssertionError && e.getCause() instanceof InterruptedException) {
+                Thread.currentThread().interrupt();
+            }
             logger.warn("Failed to download profile avatar, ignoring: {}", e.getMessage());
         }
     }