1
1
mirror of https://git.sr.ht/~emersion/tlstunnel synced 2024-11-19 15:53:50 +01:00

Log net.Listener.Close errors

This commit is contained in:
Simon Ser 2022-02-03 10:42:06 +01:00
parent 859c993a82
commit 826cbd7fe1

@ -119,8 +119,10 @@ func (srv *Server) Start() error {
func (srv *Server) Stop() {
srv.cancelACME()
for _, ln := range srv.Listeners {
ln.Stop()
for addr, ln := range srv.Listeners {
if err := ln.Stop(); err != nil {
log.Printf("listener %q: failed to stop: %v", addr, err)
}
}
srv.acmeCache.cache.Stop()
}
@ -159,7 +161,9 @@ func (srv *Server) Replace(old *Server) error {
if ln, ok := srv.Listeners[addr]; ok {
srv.Listeners[addr] = oldLn.UpdateFrom(ln)
} else {
oldLn.Stop()
if err := oldLn.Stop(); err != nil {
log.Printf("listener %q: failed to stop: %v", addr, err)
}
}
}
@ -231,8 +235,8 @@ func (ln *Listener) Start() error {
return nil
}
func (ln *Listener) Stop() {
ln.netLn.Close()
func (ln *Listener) Stop() error {
return ln.netLn.Close()
}
func (ln *Listener) UpdateFrom(new *Listener) *Listener {