Don't panic if closing a listener errors
Some checks failed
Build CI / build (push) Has been cancelled
golangci-lint / lint (push) Has been cancelled

This commit is contained in:
Palapeli 2026-05-02 14:56:06 -04:00
parent b70c693d26
commit f23a6bf8af
No known key found for this signature in database
GPG Key ID: 1FFE8F556A474925
4 changed files with 6 additions and 5 deletions

View File

@ -110,7 +110,6 @@ func Shutdown() {
db.Close()
logging.Notice("GPCM", "Saved", aurora.Cyan(len(sessions)), "sessions")
}
func CloseConnection(index uint64) {

View File

@ -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.

View File

@ -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))

View File

@ -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))