Several improvements to the codebase#26
Open
egonelbre wants to merge 13 commits into
Open
Conversation
This minimizes port definitions such that the in/out array connection don't share the unneeded methods with in/out connection. This prevents using in array and out array as an argument to .Send or .Receive, preventing some bugs. Handle possible misconnections in Connect.
When the interfaces are properly aligned, we don't need to do any casting. Similarly, by using `isDrained` simplifies the logic for checking whether the process should be still running. isDrained returns true when the connection is closed and there isn't anything more to read. Adding a method `isSelfStarting` it simplifies the startup code.
We need to track all transitions at the network level to detect deadlocks.
Currently does not handle connections properly when they are pending a handoff of work items.
egonelbre
force-pushed
the
improvements
branch
from
October 8, 2021 18:41
649aa6d to
80fc189
Compare
By default sending to an optional port will discard the packet.
To check whether port is connected to something, it's possible to use
if opt.IsConnected() {
By using the mtx for lock/unlock it makes it more clear that the send and recv path are using the same lock. Also, slightly better performance.
Tracking per process status for deadlock detection is trivial, however we need to account for connection where there are suspended receivers and senders. To properly handle this scenario we introduce a concept of "live connections". Connection is considered live when there could be further progress. Connection becomes live when: 1. There are both pending receives and sends or 2. Connection is closed and there is a pending receiver. Connection becomes unlive when: 1. There are no more receivers or 2. There are no more pending sends and the connection is empty.
* Go uses `testdata` folder to keep testing data. * Use correct filepath separators, otherwise code will have problems on Linux/Mac. * Filepaths are relative to the tests, so there's no need for Getwd. * Remove the temporary file.
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.
Please see the commit messages for each of the steps.