Skip to main content

apply_tcp_keepalive

Function apply_tcp_keepalive 

Source
pub fn apply_tcp_keepalive(socket: &Socket, idle_seconds: i32) -> Result<()>
Expand description

Applies TCP keepalive to a worker-facing ZMQ socket (the ventilator’s ROUTER, the sink’s PULL), the “stable” half of a remote worker interface: keepalive keeps idle worker connections alive across NAT/firewall idle-timeouts (an idle mapping is otherwise silently dropped, dropping the worker from the fleet until it reconnects) and lets the OS reap a dead peer’s route. It does not affect task-recovery correctness — the lease reaper is that net — so idle_seconds <= 0 safely disables it (OS default). Set before bind so accepted connections inherit it.