Repository navigation
implement ContextDial, make connect respect context cancellation - #16
whyrusleeping wants to merge 9 commits into
Conversation
| case <-success: | ||
| return | ||
| default: | ||
| poller.Close() |
There was a problem hiding this comment.
I don't think this really has any effect...
|
cc @Kubuxu for review |
|
Travis failed but it probably is SO_REUSEPORT + port 0 collision. LGTM. |
|
Yeah, it fails occasionally locally for me. But it appears to just be SO_REUSEPORT being SO_REUSEPORT and trying to reuse a port that the system is using. |
| func connect(fd int, ra syscall.Sockaddr, deadline time.Time) error { | ||
| func connect(ctx context.Context, fd int, ra syscall.Sockaddr, deadline time.Time) error { | ||
| // NOTE: We currently only use the context to pass in a deadline. | ||
| // Canceling an epoll_wait call is hard. |
There was a problem hiding this comment.
so it doesn't work with a cancel() call, right? i'd be wary of this-- then-- because it doesn't really respect ctx?
There was a problem hiding this comment.
Yeah, we still don't have a good way to use this purely via cancel. This does however let us pass the contexts timeout down farther, which is helpful
There was a problem hiding this comment.
This is a bit cheaty but it might work, adding a UDP socket to epoll_wait group and using it as wakeup call. It might work with just one socket and SO_REUSEPORT but fifo probably would work as well.
There was a problem hiding this comment.
Other option is epoll_pwait and pthread_kill.
|
Please include my last commit: Kubuxu@00e722d I fixed eventfd locally but didn't push it. |
|
@whyrusleeping you didn't add my recent commits at the https://github.com/Kubuxu/go-reuseport/tree/feat/context-dial |
|
closing, no longer needed |
This uses contexts to make the reuseport dialer respect contexts for cancellation of dials.