MCPcopy Index your code
hub / github.com/tailscale/tailscale / maxInFlightConnectionAttempts

Function maxInFlightConnectionAttempts

wgengine/netstack/netstack.go:84–105  ·  view source on GitHub ↗

maxInFlightConnectionAttempts returns the global number of in-flight connection attempts that we allow for a single netstack Impl. Any new forwarded TCP connections that are opened after the limit has been hit are rejected until the number of in-flight connections drops below the limit again. Each

()

Source from the content-addressed store, hash-verified

82// connection, so we want to ensure that we don't allow an unbounded number of
83// connections.
84func maxInFlightConnectionAttempts() int {
85 if n := maxInFlightConnectionAttemptsForTest.Load(); n > 0 {
86 return int(n)
87 }
88
89 if version.IsMobile() {
90 return 1024 // previous global value
91 }
92 switch version.OS() {
93 case "linux":
94 // On the assumption that most subnet routers deployed in
95 // production are running on Linux, we return a higher value.
96 //
97 // TODO(andrew-d): tune this based on the amount of system
98 // memory instead of a fixed limit.
99 return 8192
100 default:
101 // On all other platforms, return a reasonably high value that
102 // most users won't hit.
103 return 2048
104 }
105}
106
107// maxInFlightConnectionAttemptsPerClient is the same as
108// maxInFlightConnectionAttempts, but applies on a per-client basis

Callers 3

StartMethod · 0.85
ExpVarMethod · 0.85

Calls 3

IsMobileFunction · 0.92
OSFunction · 0.92
LoadMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…