Conversation
There was a problem hiding this comment.
Pull request overview
Updates host-side protocol flow to better align with the v0.3.1 spec by moving some response decisions out of downloadMessage and into the initial-accept phase in handleConn.
Changes:
- Refactors add-to handling so
handleAddToPathsetsInitialResponseCodeand defers sending/storing tohandleConn. - Removes the post-accept global-duplicate response path and introduces a pre-continue duplicate check in
handleConn. - Updates spec text and header field comment to include accept code 11 in
InitialResponseCode.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| src/host.go | Moves add-to response/send/store into handleConn; removes respondGlobalDuplicateIfNeeded; adds duplicate check before sending code 64. |
| src/host_test.go | Removes unit test for respondGlobalDuplicateIfNeeded. |
| src/defs.go | Updates InitialResponseCode comment to include code 11. |
| SPEC.md | Reworks receiving flow description and minor formatting tweaks. |
| @@ -510,29 +510,3 @@ func TestReadAttachmentHeadersRejectsReservedAttachmentBits(t *testing.T) { | |||
| t.Fatalf("expected reject code %d, got %v", RejectCodeInvalid, got) | |||
| } | |||
| } | |||
There was a problem hiding this comment.
This PR removes the only unit test that exercised the global duplicate response behavior, but does not add coverage for the new behavior (duplicate check now happening in handleConn before sending the initial accept code). Please add/adjust tests to cover at least:
- global duplicate rejection is sent as the initial response (code 10) when all local recipients already have the challenged message hash
- this holds for both the continue (64) and skip-data (65) paths, if those flows are intended to support global-duplicate rejection.
Suggested change
| } | |
| } | |
| func TestHandleConnRejectsGlobalDuplicateAsInitialResponseOnContinuePath(t *testing.T) { | |
| runHandleConnGlobalDuplicateInitialResponseTest(t, 64) | |
| } | |
| func TestHandleConnRejectsGlobalDuplicateAsInitialResponseOnSkipDataPath(t *testing.T) { | |
| runHandleConnGlobalDuplicateInitialResponseTest(t, 65) | |
| } | |
| func runHandleConnGlobalDuplicateInitialResponseTest(t *testing.T, expectedPath byte) { | |
| t.Helper() | |
| host, conn, done := newHandleConnTestHarness(t) | |
| t.Cleanup(func() { | |
| conn.Close() | |
| <-done | |
| }) | |
| req := newChallengedMessageRequest(t) | |
| seedAllLocalRecipientsWithChallengedHash(t, host, req) | |
| go handleConn(conn) | |
| writeHandleConnRequest(t, conn, req, expectedPath) | |
| got := readHandleConnResponseCode(t, conn) | |
| if got != 10 { | |
| t.Fatalf("expected initial global duplicate reject code 10 on path %d, got %d", expectedPath, got) | |
| } | |
| } |
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.
No description provided.