-
Notifications
You must be signed in to change notification settings - Fork 144
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
address #279: allow for parallel processing of handshakes #613
base: master
Are you sure you want to change the base?
Conversation
Thanks for the proposed change. I'm not sure about the Handshake interface, but either way we'd need to at least also have tests, and ideally an example that shows/documents how to use it. |
Definitely, didn't want to go too far down the rabbit hole if people didn't like the change. I'll spend some time making a test today. I can make an example as well. The basic idea (if unclear) is that before one would do: conn, err := ln.Accept()
if err != nil {
return err
}
go handleConn(conn) Now, one may do: hs, err := ln.AcceptHandshake()
if err != nil {
return err
}
go handleHandshaker(hs)
func handleHandshaker(hs Handshaker) {
conn, err := hs.Handshake()
if err != nil {
return
}
handleConn(conn)
} The only annoying thing is that the |
@daenney I've added a test + example. Let me know what needs changing, thanks! |
@Sean-Der Care to take a look? This has come up before and it might just be nice to fix it. It's a backwards compatible change since folks can upgrade to the proposed Handshake method of doing it. I know we've discussed something similar to this at some point for a v3 too. |
@daenney bump on this. Anything I can do to speed up the process? |
No not really, things take time as we're all unpaid volunteers. A few other maintainers need to take a look, as adding new APIs has long-term-ish consequences. I'd want us to agree on an API we would also be happy with for v3, so if users switch we don't break them all over again. |
Description
To allow for parallel handshake processing, I propose to introduce the
AcceptHandshake
method onlistener
.AcceptHandshake
returns aHandshaker
interface, which is just a conn who has not yet performed their handshake and a config for doing so. Handshakes may be processed in parallel by calling theHandshake
method on theHandshaker
in a background goroutine.Reference issue
Fixes #279