-
Notifications
You must be signed in to change notification settings - Fork 18k
Proposal: x/net/socket, vendor/golang.org/x/net/socket: new package to register socket types with package net #15984
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
Comments
Hi, thanks for submitting a proposal. My immediate question is: why? You lead by saying there is "no way to access the runtime network poller with custom socket types," but then don't provide any explanation as to why this is desirable. The rationale might be obvious to some, but it's not to me. Can you provide some background as to why and how you want to use the proposed package? Thanks! |
The intent is to enable packages which live outside the standard library to gain access to the runtime network poller, and to avoid having to duplicate the functionality of the poller externally. For example, I've written an ethernet sockets package, but because I can't use the network poller to determine when the socket has data available, my options are to either:
Ideally, third party libraries should be able to create sockets which can take advantage of Go's network poller. Also see issue #10565. |
Ping, @mikioh . |
Is this a dup of #15021? Sure looks like it. |
Ping? |
#15021 is a sibling issue but different one. We need two types of hooks from the standard library. This issue is for hooks of a tuple facility of connection endpoint, and #15021 is for hooks of I/O event multiplexing on connection endpoints. FWIW, I made a rough cut of x/net/socket package that looks a drop-in replacement of socket-related stuff in the existing syscall package this summer. It worked well on Unix variants by vendoring/replumbing. I'll send it to review once the traffic of golang-codereviews calms down. |
As of now, there is still no way to access the runtime network poller with custom socket types. As a follow up to #15021, I'd like to try implementing a new package in
x/net
that contains aSocket
type which can later be plumbed into packagenet
, enabling access to the runtime network poller.The basis of this proposal lies in a comment by @mikioh here: #15021 (comment)
I have not found a name I'm happy with for this package, but for now, let's refer to it as
x/net/socket
. The API could look something like the following:If this proposal is on the right track, I'd be happy to start working on the new package. In a later proposal, we can discuss the mechanism for plumbing it into package
net
.Thanks for your time! Let me know if there are any unresolved questions.
/cc @mikioh
The text was updated successfully, but these errors were encountered: