Skip to content

T3/disconnect final send#6

Merged
vjan-nie merged 2 commits into
Univers42:mainfrom
vjan-nie:t3/disconnect-final-send
Jul 7, 2026
Merged

T3/disconnect final send#6
vjan-nie merged 2 commits into
Univers42:mainfrom
vjan-nie:t3/disconnect-final-send

Conversation

@vjan-nie

@vjan-nie vjan-nie commented Jul 7, 2026

Copy link
Copy Markdown
Collaborator

What & why

Removes the last two unpolled send()s in the kernel (disconnectClient flush +
acceptClient "Server full"), satisfying the eliminatory rule "poll before every
accept/recv/send" with zero exceptions. Consistent with the errno-after-I/O
removal (T2). Design tradeoff (losing 464 / welcome-burst / "Server full" on
same-tick disconnects) documented in CLAUDE.md; compliant recovery = deferred
teardown, tracked as T4 (out of scope).

Verification

  • make mandatory / full: clean (-Wall -Wextra -Werror -std=c++98)
  • suite 139/139; WrongPassword/NoPassword now assert recv()==0 (EOF),
    replacing a tolerant check that guarded nothing
  • grep confirms the only kernel send() left is the EPOLLOUT-gated one in
    handleClientOutput

Note

CI's audit.sh checks single-poll + fcntl + C++98, but NOT "unpolled send" —
this compliance is verified by review + the new characterization test, not by CI.

vjan-nie added 2 commits July 7, 2026 13:51
The subject requires poll() before every accept/recv/send. Two best-effort
send()s violated this literally:
  - disconnectClient(): final flush of _out before close()
  - acceptClient():     'Server full' rejection at MAX_CLIENTS
Both are removed; the kernel now has no send() outside the EPOLLOUT-gated
path in handleClientOutput(). Consistent with the errno-after-I/O removal.

Accepted regressions (a client disconnected in the same tick its reply was
queued gets zero bytes): ERR_PASSWDMISMATCH (464), the 001-005 welcome burst
on immediate post-registration QUIT, and the 'Server full' ERROR. Compliant
recovery = deferred teardown, tracked as T4.

Characterization: WrongPassword/NoPassword now assert recv()==0 (EOF),
replacing a tolerant check that guarded nothing. Suite: 139/139.
- CLAUDE.md: fds register EPOLLIN only with on-demand EPOLLOUT (since T1);
  no disconnect flush (since T3); suite 139/139.
- tests/COVERAGE.md: errno-after-I/O row resolved (T2), poll-before-send row
  resolved (T3, both unpolled sends removed); drop hardcoded line numbers.
@vjan-nie
vjan-nie merged commit 33b96ca into Univers42:main Jul 7, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant