Skip to content

Commit

Permalink
Fix transport manager data race
Browse files Browse the repository at this point in the history
  • Loading branch information
nkryuchkov committed Dec 12, 2019
1 parent 8fe511b commit b5f049d
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions pkg/transport/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,10 @@ func (tm *Manager) serve(ctx context.Context) {
tm.Logger.Infof("listening on network: %s", netType)
listeners = append(listeners, lis)

if tm.isClosing() {
return
}

tm.wg.Add(1)
go func() {
defer tm.wg.Done()
Expand Down Expand Up @@ -298,6 +302,7 @@ func (tm *Manager) close() {
}

tm.wg.Wait()

close(tm.readCh)
}

Expand Down

0 comments on commit b5f049d

Please sign in to comment.