Fixed issues #107 and #123, receiver check connection and when pop msg fail… #147
+12
−4
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.
Fixed issues #107 and #123. The receiver now checks the connection status when popping a message fails, and calls the reconnect function if the connection check indicates that the connection is down. The root cause of the receiver's failure to pop a message is that the sender process invokes force_push() when it fails to push data into the circular queue. The force_push() function then identifies which receiver has not read the data and disconnects it. Typically, the receiver process hasn't read the data because it is either blocked (e.g., paused at a breakpoint) or stuck (when the system CPU load is high). Consequently, the receiver process has no way of knowing whether the connection was disconnected and will either wait on ::SignalObjectAndWait (when there is only one receiver in the connection) or endlessly retry popping the message.
Therefore, the solution involves making the receiver aware of disconnections so it can take action to recover, such as calling the reconnect() function. To achieve this, I have optimized the connect function and added reconnection logic in the recv() function. This approach has proven effective.