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

Add in-proc PAIR sockets #206

Merged
merged 4 commits into from
Dec 28, 2021
Merged

Add in-proc PAIR sockets #206

merged 4 commits into from
Dec 28, 2021

Conversation

Shillaker
Copy link
Collaborator

Wrapper around 0MQ PAIR sockets


std::string inprocLabel = "direct-test";

AsyncDirectSendEndpoint sender(inprocLabel, TEST_PORT);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Afaict TEST_PORT here is passed as the timeoutMs argument.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes, good spot.

}

// Make main thread wait until messages are queued
if (i == 10) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why do we need to wait for messages to be queued? Does this mean the receiver thread won't block waiting for messages to be in place?

Copy link
Collaborator Author

@Shillaker Shillaker Dec 27, 2021

Choose a reason for hiding this comment

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

The receiver thread will block, it's just that under the hood the receiver is doing the bind and the sender is doing a connect. This test forces the sender to do a connect and send messages before the recevier binds (which doesn't work for certain types of sockets IIRC). Have added a comment in the code to this effect.

REQUIRE(actual == expected);
}

TEST_CASE_METHOD(SchedulerTestFixture,
Copy link
Collaborator

Choose a reason for hiding this comment

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

For my particular use case, I'd be interested in seeing a stress test with various threads producing and various threads consuming to different in proc labels (each producer matched to one consumer).

Feel free to ignore, but I think it could be a relevant stress test.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes good idea, have updated.

@Shillaker Shillaker self-assigned this Dec 27, 2021
@Shillaker Shillaker merged commit b6b3e3d into master Dec 28, 2021
@Shillaker Shillaker deleted the zmq-pair branch December 28, 2021 13:51
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