tka: keep the CompactionDefaults alongside the other limits #6
@@ -216,6 +216,7 @@ type Impl struct {
|
|||||||
dialer *tsdial.Dialer
|
dialer *tsdial.Dialer
|
||||||
ctx context.Context // alive until Close
|
ctx context.Context // alive until Close
|
||||||
ctxCancel context.CancelFunc // called on Close
|
ctxCancel context.CancelFunc // called on Close
|
||||||
|
injectWG sync.WaitGroup // wait for the inject goroutine
|
||||||
lb *ipnlocal.LocalBackend // or nil
|
lb *ipnlocal.LocalBackend // or nil
|
||||||
dns *dns.Manager
|
dns *dns.Manager
|
||||||
|
|
||||||
@@ -450,6 +451,7 @@ func (ns *Impl) Close() error {
|
|||||||
ns.ctxCancel()
|
ns.ctxCancel()
|
||||||
ns.ipstack.Close()
|
ns.ipstack.Close()
|
||||||
ns.ipstack.Wait()
|
ns.ipstack.Wait()
|
||||||
|
ns.injectWG.Wait()
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -644,7 +646,9 @@ func (ns *Impl) Start(b LocalBackend) error {
|
|||||||
udpFwd := udp.NewForwarder(ns.ipstack, ns.acceptUDPNoICMP)
|
udpFwd := udp.NewForwarder(ns.ipstack, ns.acceptUDPNoICMP)
|
||||||
ns.ipstack.SetTransportProtocolHandler(tcp.ProtocolNumber, ns.wrapTCPProtocolHandler(tcpFwd.HandlePacket))
|
ns.ipstack.SetTransportProtocolHandler(tcp.ProtocolNumber, ns.wrapTCPProtocolHandler(tcpFwd.HandlePacket))
|
||||||
ns.ipstack.SetTransportProtocolHandler(udp.ProtocolNumber, ns.wrapUDPProtocolHandler(udpFwd.HandlePacket))
|
ns.ipstack.SetTransportProtocolHandler(udp.ProtocolNumber, ns.wrapUDPProtocolHandler(udpFwd.HandlePacket))
|
||||||
go ns.inject()
|
ns.injectWG.Go(func() {
|
||||||
|
ns.inject()
|
||||||
|
})
|
||||||
if ns.ready.Swap(true) {
|
if ns.ready.Swap(true) {
|
||||||
panic("already started")
|
panic("already started")
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -737,7 +737,10 @@ func makeHangDialer(tb testing.TB) (netx.DialFunc, chan struct{}) {
|
|||||||
// TestTCPForwardLimits verifies that the limits on the TCP forwarder work in a
|
// TestTCPForwardLimits verifies that the limits on the TCP forwarder work in a
|
||||||
// success case (i.e. when we don't hit the limit).
|
// success case (i.e. when we don't hit the limit).
|
||||||
func TestTCPForwardLimits(t *testing.T) {
|
func TestTCPForwardLimits(t *testing.T) {
|
||||||
|
tstest.AssertNotParallel(t) // calls envknob.Setenv
|
||||||
envknob.Setenv("TS_DEBUG_NETSTACK", "true")
|
envknob.Setenv("TS_DEBUG_NETSTACK", "true")
|
||||||
|
t.Cleanup(func() { envknob.Setenv("TS_DEBUG_NETSTACK", "") })
|
||||||
|
|
||||||
impl := makeNetstack(t, func(impl *Impl) {
|
impl := makeNetstack(t, func(impl *Impl) {
|
||||||
impl.ProcessSubnets = true
|
impl.ProcessSubnets = true
|
||||||
})
|
})
|
||||||
@@ -815,6 +818,7 @@ func TestTCPForwardLimits_PerClient(t *testing.T) {
|
|||||||
clientmetric.ResetForTest(t)
|
clientmetric.ResetForTest(t)
|
||||||
tstest.AssertNotParallel(t) // calls envknob.Setenv
|
tstest.AssertNotParallel(t) // calls envknob.Setenv
|
||||||
envknob.Setenv("TS_DEBUG_NETSTACK", "true")
|
envknob.Setenv("TS_DEBUG_NETSTACK", "true")
|
||||||
|
t.Cleanup(func() { envknob.Setenv("TS_DEBUG_NETSTACK", "") })
|
||||||
|
|
||||||
// Set our test override limits during this test.
|
// Set our test override limits during this test.
|
||||||
maxInFlightConnectionAttemptsForTest.Store(2)
|
maxInFlightConnectionAttemptsForTest.Store(2)
|
||||||
|
|||||||
Reference in New Issue
Block a user