From f0ca6bf85a2060b9a3edf578bedac97aa5ab5eca Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Simon=20D=C3=B6ring?= <simon.doering@stud.hs-bochum.de>
Date: Fri, 5 Feb 2021 18:45:44 +0100
Subject: [PATCH] Improve cleanup debug messages

---
 camera-server/src/janus/janus-room.ts | 2 +-
 camera-server/src/util/cleanup.ts     | 6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/camera-server/src/janus/janus-room.ts b/camera-server/src/janus/janus-room.ts
index 7012aa7..cb21b58 100644
--- a/camera-server/src/janus/janus-room.ts
+++ b/camera-server/src/janus/janus-room.ts
@@ -66,7 +66,7 @@ class JanusRoom {
             }
         }
         console.log(
-            'Warning: Janus session will timeout because long poll got no response'
+            'Warning: Janus session will timeout because long poll got no response or got cancelled'
         );
         this._sessionAlive = false;
     }
diff --git a/camera-server/src/util/cleanup.ts b/camera-server/src/util/cleanup.ts
index f543780..50adc0e 100644
--- a/camera-server/src/util/cleanup.ts
+++ b/camera-server/src/util/cleanup.ts
@@ -3,7 +3,7 @@ import { isBlocking } from '../io-interface/handlers/output-handlers';
 import { room } from '../janus/janus-room';
 
 const asyncExitHandler = async (reason: number | string | Error) => {
-    console.log('Async exit handler');
+    console.log(`Async exit handler with exit reason ${reason}`);
     try {
         await room.cleaup();
     } catch (err) {
@@ -13,8 +13,8 @@ const asyncExitHandler = async (reason: number | string | Error) => {
     process.exit(isNaN(+reason) ? 1 : +reason);
 };
 
-const syncExitHandler = () => {
-    console.log('Sync exit handler');
+const syncExitHandler = (code: number | string) => {
+    console.log(`Sync exit handler with code ${code}`);
     socketIO.emit('remove_all_feeds');
     if (isBlocking()) {
         console.log('Aborting process due to blocking file append');
-- 
GitLab