Skip to content

Commit

Permalink
close listener when basecontext is done
Browse files Browse the repository at this point in the history
  • Loading branch information
fionera committed Oct 6, 2023
1 parent 6188742 commit 43adb83
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions spop/agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,11 @@ func (a *Agent) Serve(l net.Listener) error {
a.BaseContext = context.Background()
}

go func() {
<-a.BaseContext.Done()
l.Close()
}()

for {
nc, err := l.Accept()
if err != nil {
Expand Down

0 comments on commit 43adb83

Please sign in to comment.