-
Notifications
You must be signed in to change notification settings - Fork 0
fix: enforce sequential message processing with semaphore #27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
lthibault
wants to merge
9
commits into
master
Choose a base branch
from
bugfix/message-order
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
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
- Update ProcessMessage to accept method parameter for dynamic export invocation - Add method normalization (empty string defaults to 'poll') - Add proper error handling for unknown methods with stream reset - Update all test calls to include method parameter - Maintain backward compatibility with existing code
- Switch from SetStreamHandler to SetStreamHandlerMatch - Add protocol matching for both base protocol and method suffix - Extract method from protocol string (/ww/0.1.0/<proc-id>/<method>) - Update logging to include method information - Maintain backward compatibility for existing clients
- Change method from flag to positional argument (final argument) - Update ArgsUsage to <peer> <proc> [method] - Add argument validation for 2-3 arguments - Update protocol construction to include method suffix when specified - Enhance connection banner to show method being used - Update examples in help text
- Change exported function from 'poll' to 'echo' - Update function name and comments accordingly - This demonstrates the named export functionality
- Rebuild main.wasm with updated echo export function - Binary now exports 'echo' instead of 'poll' function
- Update tests to use 'echo' function instead of 'poll' to match WASM module exports - Add Reset() expectations to mock streams to handle function not found cases - Fix TestProc_Integration_WithRealWasm, TestProc_Poll_WithGomock, TestEcho_Asynchronous, and TestEcho_RepeatedAsync - All tests now pass successfully
- Add system/ipfs.go with complete fs.FS interface implementation - Add system/ipfs_test.go with comprehensive test coverage - Support directory traversal, file reading, and sub-filesystem creation - Integrate with IPFS UnixFS for distributed file access - Add github.com/pkg/errors dependency for error handling This restores the IPFS filesystem functionality that was previously removed, enabling guest filesystem access to IPFS content.
- Replace require.NoError with t.Skipf for IPFS connection errors - Tests now gracefully skip instead of failing when IPFS is unavailable - Improves test suite robustness in environments without IPFS
- Add semaphore to Proc struct for concurrent access control - Remove semaphore from Endpoint struct (moved to Proc) - Add semaphore acquisition/release in ProcessMessage for async mode - Ensures messages are processed sequentially to maintain order - Add IPFS field to ProcConfig for filesystem mounting - Add NewFSConfig method to mount IPFS filesystem at /ipfs, /ipns, /ipld paths
614d6ae
to
6511517
Compare
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.
Problem: Async Proc mode allowed concurrent message processing, causing race conditions and message ordering issues.
Solution: Added semaphore-based concurrency control to ensure messages are processed sequentially.
Key Changes
Proc
struct (limit: 1)Endpoint
structProcessMessage
for async mode/ipfs
,/ipns
,/ipld
)Impact