src/net/limits.bend checks
raw source on the hub · import 0x09bd79c7faef22310b6d041f523d5cb2/src/net/limits.bend as Limits
2 imports
import Base import ../lib/u64.bend as U
Types
type Limits source · line 18 · raw
Data
The user-mode NAT's host-side limits (laws/limits.bend). The host keeps guest data a socket has not taken yet, and closes idle UDP flows; these numbers say how much and how long. host/hvf.c takes them once at startup (Hvf.net_limits) and applies them where it sends.
Per TCP connection: past cap bytes pending the NAT stops taking the guest's data until it drains to half; past hard (the guest sent on regardless), or with no byte taken for stall ns, the connection is reset; the flusher looks again every tick ns. Over all connections: past budget every flusher holding data blocks the guest, and a send that would pass wall resets its connection. A close with data pending sends it for at most linger ns, at most linger_max connections at once. UDP: at most udp_max flows (the least recently used goes first), each closed after udp_idle ns without a datagram.
Limits@cap:0x09bd79c7faef22310b6d041f523d5cb2/src/lib/u64.U64 -> @hard:0x09bd79c7faef22310b6d041f523d5cb2/src/lib/u64.U64 -> @stall:0x09bd79c7faef22310b6d041f523d5cb2/src/lib/u64.U64 -> @tick:0x09bd79c7faef22310b6d041f523d5cb2/src/lib/u64.U64 -> @budget:0x09bd79c7faef22310b6d041f523d5cb2/src/lib/u64.U64 -> @wall:0x09bd79c7faef22310b6d041f523d5cb2/src/lib/u64.U64 -> @linger:0x09bd79c7faef22310b6d041f523d5cb2/src/lib/u64.U64 -> @linger_max:U32 -> @udp_max:U32 -> @udp_idle:0x09bd79c7faef22310b6d041f523d5cb2/src/lib/u64.U64 -> Limits
Definitions
def Lim.mib source · line 21 · raw
@n:U32 -> 0x09bd79c7faef22310b6d041f523d5cb2/src/lib/u64.U64
def Lim.mul.go source · line 25 · raw
@n:Nat -> @+a:U32 -> @+b:0x09bd79c7faef22310b6d041f523d5cb2/src/lib/u64.U64 -> @+acc:0x09bd79c7faef22310b6d041f523d5cb2/src/lib/u64.U64 -> 0x09bd79c7faef22310b6d041f523d5cb2/src/lib/u64.U64
a * b by shifts and adds over a's 32 bits
def Lim.mul source · line 32 · raw
@a:U32 -> @b:U32 -> 0x09bd79c7faef22310b6d041f523d5cb2/src/lib/u64.U64
def Lim.secs source · line 36 · raw
@s:U32 -> 0x09bd79c7faef22310b6d041f523d5cb2/src/lib/u64.U64
s seconds in ns.
def Lim.millis source · line 40 · raw
@ms:U32 -> 0x09bd79c7faef22310b6d041f523d5cb2/src/lib/u64.U64
def Lim.default source · line 43 · raw
Limits
def Lim.sane source · line 51 · raw
@l:Limits -> Bool
The limits hold together: a connection blocks before it is reset (cap <= hard), the total blocks before it resets (budget <= wall), one connection's hard limit fits in the total, the flusher looks again well within a stall, and there is room for one UDP flow and one lingering close.
def Lim.w64 source · line 57 · raw
@a:0x09bd79c7faef22310b6d041f523d5cb2/src/lib/u64.U64 -> List<&2, U32>
def Lim.wire source · line 64 · raw
@l:Limits -> List<&2, U32>
For the host: cap, hard, stall, tick, budget, wall, linger (each hi, lo), linger_max, udp_max, udp_idle (hi, lo).