From c07061e94f38d2971f9c5c8c642973b5809f8eee Mon Sep 17 00:00:00 2001 From: Anuken Date: Mon, 14 Oct 2024 00:36:00 -0400 Subject: [PATCH] Less error message spam in debug mode --- core/src/mindustry/net/ArcNetProvider.java | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/core/src/mindustry/net/ArcNetProvider.java b/core/src/mindustry/net/ArcNetProvider.java index e7a1a33dd6..4d984265fc 100644 --- a/core/src/mindustry/net/ArcNetProvider.java +++ b/core/src/mindustry/net/ArcNetProvider.java @@ -42,7 +42,12 @@ public class ArcNetProvider implements NetProvider{ public ArcNetProvider(){ ArcNet.errorHandler = e -> { if(Log.level == LogLevel.debug){ - Log.debug(Strings.getStackTrace(e)); + var finalCause = Strings.getFinalCause(e); + + //"connection is closed" is a pointless annoying error that should not be logged + if(!"Connection is closed.".equals(finalCause.getMessage())){ + Log.debug(Strings.getStackTrace(e)); + } } }; @@ -361,10 +366,12 @@ public class ArcNetProvider implements NetProvider{ @Override public void send(Object object, boolean reliable){ try{ - if(reliable){ - connection.sendTCP(object); - }else{ - connection.sendUDP(object); + if(connection.isConnected()){ + if(reliable){ + connection.sendTCP(object); + }else{ + connection.sendUDP(object); + } } }catch(Exception e){ Log.err(e);