Week2/m4 tcp handshake - #21
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Real TCP handshake for module 4 (Week 2, closes #13).
send_line/receive_linemodule-level helpers, with a per-connectionleftover buffer so partial reads (a line split across two
recv()s) andbatched reads (two lines in one
recv()) both work.RemoteServer: binds and listens in__init__soself.portis readableimmediately (needed for tests on an OS-assigned port),
serve_forever()loops on
accept()and never lets a bad client crash it, and the handlerdoes
AUTH <token>→OK/ERR bad auth, thenREF <branch>→ the hashread straight off
.minigit/refs/heads/<branch>(or-if it doesn'texist).
push/pullnow open a real socket, run the same handshake, and printthe remote hash. All connection failures (refused, dropped, bad auth) are
mapped to
NetworkProtocolError— nothing else leaks out.minigit serve --port <n> --token <t>CLI command.WANT/OBJ) is still stubbed for Week 6, per the issue.Validation
scripts/quality-check.shChecklist
Notes for Reviewers
I have been a bit late on schedule lately, so this project's code was done by AI. I was able to check and confirm the generated code before commiting. There are some I'm not entirely sure, but I'd still like to push & merge it now. I'll validate it soon, but as for now, since no one is using module 4 and a merge is necessary. ill pr now.