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
bufconn: Implement read/write deadlines #2959
Conversation
Thank you for your pull request. Before we can look at your contribution, we need to ensure all contributors are covered by a Contributor License Agreement. After the following items are addressed, please respond with a new comment here, and the automated system will re-verify.
Regards, |
f411d9e
to
16a5db5
Compare
Thank you for your pull request. Before we can look at your contribution, we need to ensure all contributors are covered by a Contributor License Agreement. After the following items are addressed, please respond with a new comment here, and the automated system will re-verify.
Regards, |
I think I have set everything up now! |
ac4f525
to
8dcb2d4
Compare
8dcb2d4
to
eb5734f
Compare
cb5ffd5
to
2e7d845
Compare
Sorry for making such big changes after the initial review but I got a better idea to solve this PR. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, thanks! Just a couple minor things and some test-related things.
test/bufconn/bufconn_test.go
Outdated
} | ||
|
||
p1, p2 := newPipe(5), newPipe(5) | ||
c1, c2 := &conn{p1, p2}, &conn{p1, p2} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't c2
be &conn{p2, p1}
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As we write to c1
that would make c2
able to read from p2
, and no longer be blocking. I changed it to c1, c2 := &conn{p1, p1}, &conn{p2, p2}
to make this clearer.
2e7d845
to
aa4196a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great, thank you for the contribution!
Thank you! This was my first open source contribution so thank you for the guidance and feedback :) |
This PR adds implementations for the
Set(Read|Write)Deadline
functions of thenet.Conn
interface. This functionality can be useful when testing I/O edge-cases or unreliable network connections.