Skip to content

fix: preserve Remoter sends after peer write EOF - #163

Open
kentbull wants to merge 1 commit into
ioflo:mainfrom
kentbull:fix/tcp-remoter-half-close
Open

fix: preserve Remoter sends after peer write EOF#163
kentbull wants to merge 1 commit into
ioflo:mainfrom
kentbull:fix/tcp-remoter-half-close

Conversation

@kentbull

@kentbull kentbull commented Aug 15, 2026

Copy link
Copy Markdown
Contributor

What

  • Keep Remoter.cutoff as the local receive-closure indicator.
  • Add Remoter.txCutoff for independent transmit closure.
  • Allow serviceSends() to drain queued output after local receive observes peer write EOF.
  • Record local shutdown and terminal socket errors against the affected direction or directions.

Why

TCP EOF is directional. When a peer closes its write direction, no more bytes can arrive from that peer, but the Remoter may still send a response. Using receive cutoff to suppress transmission strands legitimate bytes in txbs.

KERIpy PR #1614 demonstrates one affected consumer: a witness may need to finish sending receipt bytes after the controller has finished sending its request.

Boundary

This is a focused Remoter transport change, not a general close state machine. It does not change Client, decide when higher-level protocols are complete, drain application parsers, or own final teardown. Higher-level owners remain responsible for parsing accepted input, settling output, and disposing of the endpoint.

Related HTTP admission behavior is tracked by #195.

@kentbull
kentbull force-pushed the fix/tcp-remoter-half-close branch 3 times, most recently from d9daac1 to a5a43d7 Compare August 15, 2026 20:53
@kentbull

kentbull commented Aug 15, 2026

Copy link
Copy Markdown
Contributor Author

I reduced this PR to the focused directional-state change: Remoter.cutoff records local receive EOF, while txCutoff governs transmission. Peer write shutdown therefore no longer prevents the Remoter from finishing queued sends.

Higher-level owners remain responsible for parsing accepted input, settling output, and final teardown. WebOfTrust/keripy#1614 demonstrates one consumer of that distinction.

@kentbull

kentbull commented Aug 19, 2026

Copy link
Copy Markdown
Contributor Author

The maintained 0.6 adaptation is merged as GLEIF-IT#3.

The prior .cutoff = True var prevented half-closed TCP connections from properly servicing the non-closed half. EOF on the sender side of a TCP connection prevented final response bytes being received by the sender from the receiver side of the TCP connection.

New explicit states for both sides of the TCP connection clarify whether bytes can be sent or received and whether a connection is half closed, fully closed (terminated), or failed.

The pre-existing cutoff var is supported yet deprecated.
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