From 45b2e6db5c8df04b85cf646d1744646d1e679c6d Mon Sep 17 00:00:00 2001 From: Romain Vimont Date: Fri, 10 Feb 2023 19:06:17 +0100 Subject: [PATCH] Log component stopped in finally clause The message must be logged even when no exception occurs. --- server/src/main/java/com/genymobile/scrcpy/Controller.java | 1 + .../main/java/com/genymobile/scrcpy/DeviceMessageSender.java | 1 + server/src/main/java/com/genymobile/scrcpy/Server.java | 2 +- 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/server/src/main/java/com/genymobile/scrcpy/Controller.java b/server/src/main/java/com/genymobile/scrcpy/Controller.java index 02684a1d..02d77cb1 100644 --- a/server/src/main/java/com/genymobile/scrcpy/Controller.java +++ b/server/src/main/java/com/genymobile/scrcpy/Controller.java @@ -90,6 +90,7 @@ public class Controller { control(); } catch (IOException e) { // this is expected on close + } finally { Ln.d("Controller stopped"); } }); diff --git a/server/src/main/java/com/genymobile/scrcpy/DeviceMessageSender.java b/server/src/main/java/com/genymobile/scrcpy/DeviceMessageSender.java index b0e2a388..0ef2a9ee 100644 --- a/server/src/main/java/com/genymobile/scrcpy/DeviceMessageSender.java +++ b/server/src/main/java/com/genymobile/scrcpy/DeviceMessageSender.java @@ -57,6 +57,7 @@ public final class DeviceMessageSender { loop(); } catch (IOException | InterruptedException e) { // this is expected on close + } finally { Ln.d("Device message sender stopped"); } }); diff --git a/server/src/main/java/com/genymobile/scrcpy/Server.java b/server/src/main/java/com/genymobile/scrcpy/Server.java index ac5f0293..cfb45e33 100644 --- a/server/src/main/java/com/genymobile/scrcpy/Server.java +++ b/server/src/main/java/com/genymobile/scrcpy/Server.java @@ -111,8 +111,8 @@ public final class Server { screenEncoder.streamScreen(device, videoStreamer); } catch (IOException e) { // this is expected on close - Ln.d("Screen streaming stopped"); } finally { + Ln.d("Screen streaming stopped"); initThread.interrupt(); if (controller != null) { controller.stop();