aboutsummaryrefslogtreecommitdiff
path: root/docs/tcp.html (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Merge pull request #463 from lunarmodules/feat/receive-limitCaleb Maclennan3 days1-10/+22
|\ | | | | feat(receive): add maxsize argument to bound memory usage
| * chore(docs): some cleanupThijs Schreijer2026-08-171-46/+6
| |
| * feat(receive): add maxsize argument to bound memory usageThijs Schreijer2026-07-301-3/+55
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | client:receive("*l") and receive("*a") are unbounded: a peer that never sends a newline, or never closes, makes LuaSocket buffer until the process runs out of memory (e.g. src/http.lua reading response headers in a loop). Add an optional maxsize argument that caps the payload a single call may accumulate, including prefix. - Hoist all argument validation ahead of timeout_markstart() so bad calls (maxsize < 1, #prefix >= maxsize, numeric pattern > maxsize) raise before any I/O and leave the socket untouched. - recvline/recvall take a budget and return a new internal BUF_OVERSIZED code, surfaced to Lua as the "oversized" error alongside "timeout"/"closed", with the partial held in the 3rd return value. - recvraw is left untouched: argument checks make the cap unreachable for numeric patterns. - Preserve three invariants: a timeout partial is always shorter than maxsize (safe to retry as prefix), completion beats the cap for *a, and no bytes are lost or skipped on overflow. - tcp.c, unixstream.c and serial.c all share this code path unchanged. Adds test coverage (argument errors, *l/*a boundaries, timeout/close at the cap, the drain idiom, numeric patterns, unix-stream mirror) and documents the new argument, error, and recovery idioms in docs/tcp.html.
* | chore(docs): add docs for SO_EXCLUSIVEADDRUSE and othersThijs Schreijer3 days1-1/+30
|/ | | | | Adds docs for the option, but also adds the docs for other options present in the code but missing from the docs.
* feat(tcp): Add support for TCP Defer AcceptKim Alvefur2022-07-271-0/+2
| | | | | | | | This makes it so that a listening socket does not become readable for accept() until a connection has been fully established *and* started sending something, thus the program doesn't have to wait for the first data. This only makes sense for client-speaks-first protocols. Co-authored-by: Caleb Maclennan <caleb@alerque.com>
* feat(tcp): Add support for TCP Fast OpenKim Alvefur2022-07-271-0/+4
|
* Move doc→docs so we can serve it with GitHub PagesCaleb Maclennan2022-03-231-0/+732