Skip to content

Rework the TFTP server and client, fix their bugs, add tests and CI - #1

Merged
nirkem merged 3 commits into
mainfrom
cleanup
Oct 5, 2026
Merged

nirkem merged 3 commits into
mainfrom
cleanup

Conversation

@nirkem

@nirkem nirkem commented Oct 5, 2026

Copy link
Copy Markdown
Owner

Turns the course submission into something presentable and correct.

Bugs fixed (each reproduced against the original code first)

  • Uploads of an exact multiple of 512 bytes never finished: the client never sent the closing empty block, and a 1024-byte upload left an empty file on the server.
  • The client's keyboard thread used a bare wait() and was woken by every ACK, DATA or broadcast, so it could run the next command mid-upload or hang forever. It now waits on a condition.
  • DIRQ separated names with the character '0', so exact1024.bin listed as exact1 and 24.bin.
  • RRQ ../server.log read files outside Files/.
  • Login was check-then-set across two calls, and a client that dropped without DISC kept its name forever.
  • An upload's file existed (empty) from the moment it started.

Structure

  • common module shared by both sides (packets + framer); server keeps the thread-per-client design.
  • Course skeleton examples, the instructions PDF and third-party media removed.

Tests

  • mvn verify: 7 framer tests + 26 server tests over real sockets, including races of 20 clients.
  • tests/e2e.sh: 23 checks against the real jars.
  • GitHub Actions runs both.

🤖 Generated with Claude Code

nirkem and others added 3 commits October 5, 2026 18:27
- Shared common module: packet builders and one byte-stream framer for both sides
- Server: per-client cleanup on disconnect, atomic login and upload-name claims,
  uploads written only when complete, file names confined to Files/,
  0-byte separators in directory listings
- Client: the keyboard thread waits on a condition the listener clears at the end
  of each operation; uploads of a multiple of 512 bytes now send the closing block
- 33 JUnit tests (framing, server over real sockets, races) and a 23-check
  end-to-end script, run in GitHub Actions
- Remove the course instructions PDF, the skeleton echo/newsfeed/rci examples and
  third-party media from the sample files; add a README

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The raw test client read its socket a byte per system call, which made the
33,000-block download test time out on the CI runner.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@nirkem
nirkem merged commit 3138413 into main Oct 5, 2026
2 checks passed
@nirkem
nirkem deleted the cleanup branch October 5, 2026 15:48
nirkem added a commit that referenced this pull request Oct 5, 2026
* Rework the TFTP server and client, fix their bugs, add tests and CI

- Shared common module: packet builders and one byte-stream framer for both sides
- Server: per-client cleanup on disconnect, atomic login and upload-name claims,
  uploads written only when complete, file names confined to Files/,
  0-byte separators in directory listings
- Client: the keyboard thread waits on a condition the listener clears at the end
  of each operation; uploads of a multiple of 512 bytes now send the closing block
- 33 JUnit tests (framing, server over real sockets, races) and a 23-check
  end-to-end script, run in GitHub Actions
- Remove the course instructions PDF, the skeleton echo/newsfeed/rci examples and
  third-party media from the sample files; add a README

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Buffer the test client's reads and give the long transfer test more time

The raw test client read its socket a byte per system call, which made the
33,000-block download test time out on the CI runner.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Point the README badge at the renamed repo

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
nirkem added a commit that referenced this pull request Oct 5, 2026
* Rework the TFTP server and client, fix their bugs, add tests and CI

- Shared common module: packet builders and one byte-stream framer for both sides
- Server: per-client cleanup on disconnect, atomic login and upload-name claims,
  uploads written only when complete, file names confined to Files/,
  0-byte separators in directory listings
- Client: the keyboard thread waits on a condition the listener clears at the end
  of each operation; uploads of a multiple of 512 bytes now send the closing block
- 33 JUnit tests (framing, server over real sockets, races) and a 23-check
  end-to-end script, run in GitHub Actions
- Remove the course instructions PDF, the skeleton echo/newsfeed/rci examples and
  third-party media from the sample files; add a README

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Buffer the test client's reads and give the long transfer test more time

The raw test client read its socket a byte per system call, which made the
33,000-block download test time out on the CI runner.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Point the README badge at the renamed repo

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
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