The point Mikio is raising is as follows:
> Dial and Listen functions are complexes; Should the user-defined control function be applied to derived sockets such as DNS transport for dialing? Or should we have a separate control function for such stuff? Should we need to expose internal functionality that is now part of dialing/listening for supporting user-defined control functions?
The core problem described in issue talks about is not being able to set socket options such as SO_REUSEPORT. This is my motive for working on this.
From the side of pragmatism, that is all that is being asked here. In C, setsocketopt does not propagate down, and only affects the socket in question, and this is the goal.
Yes, the Control interface might be a bit too generic, hence why this feeling of need to propagate it down comes up.
I wouldn't mind SocketOption[] as the API, this way it's clear it's only affecting the socket in question, as that is how other languages behave.
Exposing access to the runtime network poller could be another workaround for the issue, but I haven't yet evaluated how setting options before dialing would look like, and my suspicion is that it would be quite complicated, as you'd handle blocking connect syscall yourself and so on.
Having read comments on the long standing github issue, I don't think anyone is interested for this options to propagate down to other connections, nor does there seem to be any appetite to expose the runtime poller.
I am still in favour of the Control function API, as I feel it's a bit more flexible in terms of you getting a handle on the uintptr if you really need to, even if it's confusing if the control function propagates down. I think the confusion can be cleared up with adequate documentation
I don't understand why the blindness matters. The user is completely
in control of both how the socket is created and of the RawConn
interface to use. Why do we need to explicitly pass information like
address family to the user supplied function, when the user is
determining that information anyhow with the way that they call Dial
and Listen?
That is probably OK with me. What would the struct fields be?
I am honestly not worried about confusing users who choose to use the
RawConn interface.
I am honestly not worried about confusing users who choose to use the
RawConn interface.As far as I understand, RawConn interface is just for established, inflight sockets. I think that using RawConn interface is not appropriate for manipulating larval sockets.
In addition, there are options that should be set during creation (e.g., UDP/UDP-lite, close-on-exec). So I'd rather see
What do you mean by UDP/UDP-lite? How does that affect the socket syscall that creates the fd?
As far as I understand, RawConn interface is just for established, inflight sockets. I think that using RawConn interface is not appropriate for manipulating larval sockets.I don't see why not.
Control func(network, address string, c syscall.RawConn) error
Is everyone happy with that, and ListenControl?
I am not sure what you mean by using existing signatures, given there is no way to pass anything new apart to the existing signatures apart from adding variadic arguments?
If we add Announcer type in net, yes, that would work, but I think we've settled on ListenControl, with ControlFunc signature to be changed to
func(net, addr string, conn syscall.RawConn) error
Instead of
func(conn syscall.RawConn) error
Or am I misunderstanding something?
Sorry, but I am failing to connect how this relates to the existing CL, as that still does not add an API to be able to set socket options.If we add Announcer type in net, yes, that would work, but I think we've settled on ListenControl,
So I've updated the CL with my interpretation (or misinterpretation) of what was discussed here. What happens now?
--
You received this message because you are subscribed to the Google Groups "golang-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-dev+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.