Skip to content

Several improvements to the codebase#26

Open
egonelbre wants to merge 13 commits into
jpaulm:masterfrom
egonelbre:improvements
Open

Several improvements to the codebase#26
egonelbre wants to merge 13 commits into
jpaulm:masterfrom
egonelbre:improvements

Conversation

@egonelbre

Copy link
Copy Markdown
Contributor

Please see the commit messages for each of the steps.

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.
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.
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