mirror of
https://github.com/Control-D-Inc/ctrld.git
synced 2026-08-23 01:27:13 +02:00
internal/net: enforce timeout for probing stack
On Windows host with StarLink network, ctrld hangs on startup for ~30s before continue running. This dues to IPv6 is configured but no external IPv6 can be reached. When probing stack, ctrld is dialing using ipv6 without any timeout set, so the dialing timeout is enforced by OS. This commit adds a timeout for probing dialer, so we ensure the probing process will fail fast.
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
package net
|
||||
|
||||
import (
|
||||
"context"
|
||||
"testing"
|
||||
"time"
|
||||
)
|
||||
|
||||
func TestProbeStackTimeout(t *testing.T) {
|
||||
done := make(chan struct{})
|
||||
started := make(chan struct{})
|
||||
go func() {
|
||||
defer close(done)
|
||||
close(started)
|
||||
supportIPv6(context.Background())
|
||||
}()
|
||||
|
||||
<-started
|
||||
select {
|
||||
case <-time.After(probeStackTimeout + time.Second):
|
||||
t.Error("probeStack timeout is not enforce")
|
||||
case <-done:
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user