mirror of
https://github.com/tailscale/tailscale.git
synced 2025-04-01 05:52:24 +00:00
wgengine/magicsock: clean up derp http servers on shutdown.
Failure to do this leads to fd exhaustion at -count=10000, and increasingly poor execution north of -count=100. Signed-off-by: David Anderson <danderson@tailscale.com>
This commit is contained in:
parent
d651715528
commit
7eda3af034
@ -267,7 +267,6 @@ func runDERP(t *testing.T) (s *derp.Server, addr string, cleanupFn func()) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
s = derp.NewServer(serverPrivateKey, t.Logf)
|
s = derp.NewServer(serverPrivateKey, t.Logf)
|
||||||
// TODO: cleanup httpsrv.CloseClientConnections / Close
|
|
||||||
|
|
||||||
httpsrv := httptest.NewUnstartedServer(derphttp.Handler(s))
|
httpsrv := httptest.NewUnstartedServer(derphttp.Handler(s))
|
||||||
httpsrv.Config.TLSNextProto = make(map[string]func(*http.Server, *tls.Conn, http.Handler))
|
httpsrv.Config.TLSNextProto = make(map[string]func(*http.Server, *tls.Conn, http.Handler))
|
||||||
@ -276,6 +275,8 @@ func runDERP(t *testing.T) (s *derp.Server, addr string, cleanupFn func()) {
|
|||||||
|
|
||||||
addr = strings.TrimPrefix(httpsrv.URL, "https://")
|
addr = strings.TrimPrefix(httpsrv.URL, "https://")
|
||||||
cleanupFn = func() {
|
cleanupFn = func() {
|
||||||
|
httpsrv.CloseClientConnections()
|
||||||
|
httpsrv.Close()
|
||||||
s.Close()
|
s.Close()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user