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

propagate context to message read and write in p2p protocols #840

Merged
merged 3 commits into from
Oct 20, 2020

Conversation

janos
Copy link
Member

@janos janos commented Oct 15, 2020

This PR adjusts protobuf message read and write calls to use context for cancelation, by either adding it or replacing with timeout variant. More cancelation control is provided with context, so functions with timeout are removed. These changes may improve overall communication in not perfect network conditions and with overloaded peers.

Since pseudosettle is changed to use context in handler while reading a message, TestPayment was very flaky, as the context cancled in Pay method would cancel the context passed to the handler through streamtest Recorder. Two changes were made to fix this. First not to couple client call context with handler context in streamtest Recorder, and the second is are improvements to TestPayment to check for record error and also to synchronize observer call with a channel.

@janos janos added the ready for review The PR is ready to be reviewed label Oct 15, 2020
@janos janos self-assigned this Oct 15, 2020
@janos janos requested review from acud and removed request for pradovic October 15, 2020 16:33
Copy link
Member

@acud acud left a comment

Choose a reason for hiding this comment

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

very cool. thanks janos

@janos janos requested a review from zbiljic October 20, 2020 15:36
@janos janos merged commit b65f50e into master Oct 20, 2020
@janos janos deleted the p2p-cancelation-propagation branch October 20, 2020 16:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pull-request ready for review The PR is ready to be reviewed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants