-
-
Notifications
You must be signed in to change notification settings - Fork 108
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 helpers Serve and ListenAndServe #355
Conversation
Just a quick thing: can you lowercase the file names? |
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.
This is definitely on the right track. Don't be alarmed by the number of suggestions -- I'm just being thorough 🙂
And by the way, thanks for the contribution! 🙌
What is still missing is TLS support. I think that is a must for use in production. |
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.
A few things in-line. Additionally, it would be good to have a test or two that supplies a bootstrap interface and checks that it behaves as expected, incl. across connections (would catch the issue I pointed out in Serve()).
Quoting Henk (2022-11-29 21:24:50)
On that last note, I found that when passing context to ...
"ListenConfig).Listen(ctx, " ... it doesn't seem to respond to
cancelling the context. Not sure if there is a good reason for using
context here, other than as convention.
If there's no actual effect then I'd prefer just using net.Listen; keep
it simple.
|
After digging a bit deeper it is passed to a netFD.connect which does use it although how exactly I can't follow. I'm a bit concerned what happens if the context isn't closed after exit. ... since it isn't doing anything for our use-case lets stick to the regular listen. |
Indeed a good point. I'll expand the tests with using a bootstrap interface. |
Added a test that uses Serve to transfer data.
Change API to take bootstrap client instead of options Added testcase to verify proper method handling using Serve. Added verification of proper release of capabilities. Update documentation to explain the functions release bootstrap client.
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.
A few more things in line.
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.
Almost there!
Remove the goroutine for handling the incoming connection as rpc.NewConn already does this.
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.
Almost done. The first PR always involves a bit of back-and-forth 🙂
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.
I think this is good to go! 🙂 🎉
Test failure looks like #349. Re-running tests. |
First draft of a helper for Serve and ListenAndServe.
Using context for ListenAndServe as it is the only way to close it when needed.