mirror of
https://github.com/qdm12/gluetun.git
synced 2026-05-07 04:20:12 +02:00
hotfix(pmtud/tcp): fix rare race condition
This commit is contained in:
@@ -73,18 +73,21 @@ func pathMTUDiscover(ctx context.Context, addrPort netip.AddrPort,
|
||||
doneCh := make(chan struct{})
|
||||
for i := range tests {
|
||||
go func(i int) {
|
||||
err := runTest(runCtx, fd, tracker, addrPort, tests[i].mtu)
|
||||
err := runTest(runCtx, fd, tracker, src, dst, tests[i].mtu)
|
||||
tests[i].ok = err == nil
|
||||
doneCh <- struct{}{}
|
||||
}(i)
|
||||
}
|
||||
|
||||
for range tests {
|
||||
i := 0
|
||||
for i < len(tests) {
|
||||
select {
|
||||
case <-doneCh:
|
||||
i++
|
||||
case err := <-errCh:
|
||||
if err == nil { // timeout
|
||||
break
|
||||
cancel()
|
||||
continue
|
||||
}
|
||||
return 0, fmt.Errorf("listening for TCP replies: %w", err)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user