From 0d51b3960473d131e7cdac5fff4c86740134dee6 Mon Sep 17 00:00:00 2001 From: Denny Sheirer Date: Sat, 9 May 2020 15:20:33 +0000 Subject: [PATCH] #808 Improves broadcastify calls socket reset exception handling. (#810) Co-authored-by: Denny --- .../broadcastify/BroadcastifyCallBroadcaster.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/main/java/io/github/dsheirer/audio/broadcast/broadcastify/BroadcastifyCallBroadcaster.java b/src/main/java/io/github/dsheirer/audio/broadcast/broadcastify/BroadcastifyCallBroadcaster.java index 048290ea..4f68cf6e 100644 --- a/src/main/java/io/github/dsheirer/audio/broadcast/broadcastify/BroadcastifyCallBroadcaster.java +++ b/src/main/java/io/github/dsheirer/audio/broadcast/broadcastify/BroadcastifyCallBroadcaster.java @@ -48,6 +48,7 @@ import java.net.http.HttpResponse; import java.time.Duration; import java.util.List; import java.util.Queue; +import java.util.concurrent.CompletionException; import java.util.concurrent.LinkedTransferQueue; import java.util.concurrent.ScheduledFuture; import java.util.concurrent.TimeUnit; @@ -240,14 +241,14 @@ public class BroadcastifyCallBroadcaster extends AbstractAudioBroadcaster { if(throwable != null || stringHttpResponse.statusCode() != 200) { - if(throwable instanceof IOException) + if(throwable instanceof IOException || throwable instanceof CompletionException) { //We get socket reset exceptions occasionally when the remote server doesn't //fully read our request and immediately responds. } else { - mLog.error("Error while sending upload URL request", throwable); + mLog.error("Error while sending upload URL request" + throwable.getLocalizedMessage()); setBroadcastState(BroadcastState.TEMPORARY_BROADCAST_ERROR); } incrementErrorAudioCount(); @@ -284,7 +285,7 @@ public class BroadcastifyCallBroadcaster extends AbstractAudioBroadcaster { if(throwable1 != null || fileResponse.statusCode() != 200) { - if(throwable1 instanceof IOException) + if(throwable1 instanceof IOException || throwable1 instanceof CompletionException) { //We get socket reset exceptions occasionally when the remote server doesn't //fully read our request and immediately responds.