fix: resolve allowHalfOpen behavior and refactor NativeModules usage#230
Merged
Rapsssito merged 2 commits intoRapsssito:masterfrom Jan 16, 2026
Merged
fix: resolve allowHalfOpen behavior and refactor NativeModules usage#230Rapsssito merged 2 commits intoRapsssito:masterfrom
Rapsssito merged 2 commits intoRapsssito:masterfrom
Conversation
Owner
|
Hi @akai07, Thanks for the PR! Could you please fix the lint and type issues regarding Jest? As soon as you fix those, I will merge the PR. |
ced7971 to
bfcd1c5
Compare
github-actions bot
pushed a commit
that referenced
this pull request
Jan 16, 2026
## [6.4.1](v6.4.0...v6.4.1) (2026-01-16) ### Bug Fixes * resolve allowHalfOpen behavior ([#230](#230)) ([dafe6f4](dafe6f4))
|
🎉 This PR is included in version 6.4.1 🎉 The release is available on: Your semantic-release bot 📦🚀 |
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
This PR fixes a critical issue where
allowHalfOpen: false(default) failed to trigger the socket end sequence correctly, causingUnexpectedEOFErrorin relay dialing scenarios. It also refactors theSocket.jsmodule to useNativeModules.TcpSocketsdirectly, eliminating potential variable scoping issues during testing.Changes
allowHalfOpenLogic: Modified theendevent listener insrc/Socket.js. WhenallowHalfOpenis false,this.end()is now called before emitting the'end'event to consumers. This ensures the FIN packet is sent immediately, matching Node.jsnetbehavior.NativeModules: Removed the file-levelconst Socketsdeclaration and replaced all usages with directNativeModules.TcpSocketscalls. This prevents stale closure captures in test environments where mocks may be reset.Verification
npm test __tests__/allowHalfOpen.test.jsexpect(Sockets.end).toHaveBeenCalled()).Related Issues
Fixes relay dialing
UnexpectedEOFError.