From f23a6bf8af769c81cd41b072e1f98b197251efaf Mon Sep 17 00:00:00 2001 From: Palapeli <26661008+mkwcat@users.noreply.github.com> Date: Sat, 2 May 2026 14:56:06 -0400 Subject: [PATCH] Don't panic if closing a listener errors --- gpcm/main.go | 1 - main.go | 6 ++++-- natneg/main.go | 2 +- qr2/main.go | 2 +- 4 files changed, 6 insertions(+), 5 deletions(-) diff --git a/gpcm/main.go b/gpcm/main.go index eb1b0e1..d13fe91 100644 --- a/gpcm/main.go +++ b/gpcm/main.go @@ -110,7 +110,6 @@ func Shutdown() { db.Close() logging.Notice("GPCM", "Saved", aurora.Cyan(len(sessions)), "sessions") - } func CloseConnection(index uint64) { diff --git a/main.go b/main.go index fea3252..a25a587 100644 --- a/main.go +++ b/main.go @@ -359,8 +359,10 @@ func frontendMain(noSignal, noBackend bool) { rpcMutex.Unlock() logging.Notice("FRONTEND", "Sending RPCPacket.Shutdown") - common.ShouldNotError(rpcClient.Call("RPCPacket.Shutdown", "", nil)) - common.ShouldNotError(rpcClient.Close()) + if err := rpcClient.Call("RPCPacket.Shutdown", "", nil); err != nil { + logging.Error("FRONTEND", "Error during backend shutdown:", err.Error()) + } + _ = rpcClient.Close() } // startFrontendServer starts the frontend RPC server. diff --git a/natneg/main.go b/natneg/main.go index ec12c8d..297ef8a 100644 --- a/natneg/main.go +++ b/natneg/main.go @@ -130,7 +130,7 @@ func StartServer(reload bool) { // Close the listener when the application closes. defer func() { - common.ShouldNotError(conn.Close()) + _ = conn.Close() }() logging.Notice("NATNEG", "Listening on", aurora.BrightCyan(address)) diff --git a/qr2/main.go b/qr2/main.go index 058638e..42f5063 100644 --- a/qr2/main.go +++ b/qr2/main.go @@ -93,7 +93,7 @@ func StartServer(reload bool) { // Close the listener when the application closes. defer func() { - common.ShouldNotError(conn.Close()) + _ = conn.Close() }() logging.Notice("QR2", "Listening on", aurora.BrightCyan(address))