Skip to content

Commit

Permalink
Fix panic send on closed channel in DockerTestFramework
Browse files Browse the repository at this point in the history
  • Loading branch information
muXxer committed May 17, 2024
1 parent 4cce1bd commit ab7a360
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions tools/docker-network/tests/dockertestframework/framework.go
Original file line number Diff line number Diff line change
Expand Up @@ -138,8 +138,11 @@ func (d *DockerTestFramework) Run() error {

ch := make(chan error)
stopCh := make(chan struct{})
defer close(ch)
defer close(stopCh)

defer func() {
close(stopCh)
close(ch)
}()

ts := time.Now()
go func() {
Expand All @@ -149,10 +152,14 @@ func (d *DockerTestFramework) Run() error {
select {
case <-stopCh:
return

default:
select {
case <-stopCh:
return
case ch <- err:
}
}

ch <- err
}()

timer := time.NewTimer(d.optsWaitForSync)
Expand Down

0 comments on commit ab7a360

Please sign in to comment.