Skip to content
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

Socket refactor #136

Merged
merged 4 commits into from
Sep 25, 2018
Merged

Socket refactor #136

merged 4 commits into from
Sep 25, 2018

Conversation

MisterTea
Copy link
Owner

@MisterTea MisterTea commented Sep 24, 2018

To prepare for a more end-to-end testing framework, I forked UnixSocketHandler (USH) to create TcpSocketHandler and PipeSocketHandler that both inherit from USH. To create a unified interface, I created SocketEndpoint, which has either port and/or name set. In the case of PipeSocketHandler, there is no port so it will be -1 (unset). For TcpSocketHandler, we don't have a name when listening on a port on all interfaces, but otherwise both will be set.

RawSocketUtils is now only used when communicating to stdout/stdin or to the terminal pty file descriptor (basically, cases where we only control one endpoint so we have to send raw data without any protocol).

One nice effect of this is that we can swap a TCP connection for an IPC connection whenever we want. This is used in TestBacked where we now use IPC connections instead of TCP. This means we can run thousands of tests in parallel without having to worry about port collisions, which is important for when we want to stress the system.

Also, I made all sockets non-blocking at all times. Currently we still block ourselves in a while loop above many of the calls, but in the future I plan on making the system more asynchronous so we can remove all multi-threaded programming and let the OS handle the concurrency.

@MisterTea MisterTea requested a review from ailzhang September 24, 2018 06:09
Copy link
Collaborator

@ailzhang ailzhang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works for -J case. Testing on my end.

@MisterTea MisterTea merged commit 6fb4daf into master Sep 25, 2018
@MisterTea MisterTea deleted the socket_refactor branch September 25, 2018 03:56
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.

2 participants