server: Use separate context to cancel listeners
Use a separate context to cancel listeners so that cancelling the listener does not cancel it's connections.
This commit is contained in:
parent
6c701ad9fe
commit
3fa55b52dd
@ -205,7 +205,7 @@ func (srv *Server) Serve(ctx context.Context, l net.Listener) error {
|
|||||||
return ErrServerClosed
|
return ErrServerClosed
|
||||||
}
|
}
|
||||||
|
|
||||||
ctx, cancel := context.WithCancel(ctx)
|
lnctx, cancel := context.WithCancel(ctx)
|
||||||
defer cancel()
|
defer cancel()
|
||||||
|
|
||||||
srv.trackListener(&l, cancel)
|
srv.trackListener(&l, cancel)
|
||||||