Fix attempt.

This commit is contained in:
2025-12-08 06:49:07 +02:00
parent a65a31fdac
commit d8ddb6be71

View File

@@ -107,11 +107,11 @@ func (s *Server) logger() Logger {
} }
// Serve accepts incoming connections on the listener ln. // Serve accepts incoming connections on the listener ln.
func (s *Server) Serve(ln net.Listener) error { func (s *Server) Serve(ln net.Listener, addr string) error {
s.mutex.Lock() s.mutex.Lock()
ok := !s.closed ok := !s.closed
if ok { if ok {
s.listeners[ln] = struct{}{} s.listeners[addr] = struct{}{}
} }
s.mutex.Unlock() s.mutex.Unlock()
if !ok { if !ok {
@@ -164,7 +164,7 @@ func (s *Server) ListenAndServe(addr string) error {
if err != nil { if err != nil {
return err return err
} }
return s.Serve(ln) return s.Serve(ln, addr)
} }
// ListenAndServeTLS listens on the TCP network address addr and then calls // ListenAndServeTLS listens on the TCP network address addr and then calls
@@ -180,7 +180,7 @@ func (s *Server) ListenAndServeTLS(addr string) error {
if err != nil { if err != nil {
return err return err
} }
return s.Serve(ln) return s.Serve(ln, addr)
} }
// Close immediately closes all active listeners and connections. // Close immediately closes all active listeners and connections.