A few issues in the server's Serve path:
listener() silently falls back to cleartext when tlsConfig returns an error, even though the operator asked for TLS. The error should be surfaced instead.
serveErrChan is unbuffered and the non-OpError branch does not return, leaving a sender blocked on shutdown and leaking the goroutine.
- The signal-handler goroutine does not exit on context cancel and
signal.Notify is never stopped, so goroutines accumulate across repeated Serve calls.
A few issues in the server's
Servepath:listener()silently falls back to cleartext whentlsConfigreturns an error, even though the operator asked for TLS. The error should be surfaced instead.serveErrChanis unbuffered and the non-OpErrorbranch does not return, leaving a sender blocked on shutdown and leaking the goroutine.signal.Notifyis never stopped, so goroutines accumulate across repeatedServecalls.