-
Notifications
You must be signed in to change notification settings - Fork 11
Description
Describe the bug
recv() can recursively call itself when handling certain recoverable conditions (e.g. timeouts, source discovery, or filtered packets). If these conditions persist, recursion can become unbounded, leading to deep call stacks, potential stack overflow, and hard-to-reason-about control flow. This also obscures termination conditions and makes error handling dependent on recursion depth rather than explicit logic.
Expected behaviour
recv() should use an explicit loop instead of recursion to retry or skip packets. Control flow should be iterative, with clearly defined exit conditions (successful packet receipt, timeout, or error), ensuring bounded stack usage and predictable behaviour consistent with the protocol’s receive semantics.