Only log the exception when unexpected

The socket is closed in another thread to stop the transmission.
That causes an exception, but that is the expected behaviour, so
do not log it.
This commit is contained in:
Fabian Wiesel
2024-02-20 22:12:32 +01:00
parent 523ee93d75
commit 77c8456d45

View File

@@ -167,9 +167,11 @@ public class MonitorService extends Service {
serviceConnection(socket);
}
} catch (Exception e) {
// Just in case
currentPort++;
Log.e(TAG, "Failed to open server socket. Port increased to " + currentPort, e);
if (Objects.equals(connectionToken, currentToken)) {
// Just in case
currentPort++;
Log.e(TAG, "Failed to open server socket. Port increased to " + currentPort, e);
}
}
}
});