Skip to content

Commit

Permalink
Fix race while server shutdown
Browse files Browse the repository at this point in the history
  • Loading branch information
juliens authored and traefiker committed Mar 21, 2019
1 parent 79ecff7 commit d898ea3
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion pkg/server/server_entrypoint_tcp.go
Original file line number Diff line number Diff line change
Expand Up @@ -312,11 +312,13 @@ func (c *connectionTracker) Shutdown(ctx context.Context) error {

// Close close all the connections in the tracked connections list
func (c *connectionTracker) Close() {
c.lock.Lock()
defer c.lock.Unlock()
for conn := range c.conns {
if err := conn.Close(); err != nil {
log.WithoutContext().Errorf("Error while closing connection: %v", err)
}
c.RemoveConnection(conn)
delete(c.conns, conn)
}
}

Expand Down

0 comments on commit d898ea3

Please sign in to comment.