-
Notifications
You must be signed in to change notification settings - Fork 100
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
Detach a connection from watcher. #11
Comments
but the file descriptor in the original net.Conn has been closed when watching , the working fd in watcher is dup() -ed from net.Conn. |
Yes, it is. You can recover f := os.NewFile(uintptr(fd), "dup-fd")
conn, err := net.FileConn(f)
_ = f.Close()
return conn, err |
that makes sense, could you submit a PR to this issue for me to review the details? |
Cool! I'll submit one when I have time. 不过有个设计上的问题。我目前是在回调里用 |
A watcher.Detach(conn) func is preferred. |
In a project, I need to detach a connection from the watcher and send it to another process, so I modified the flow of
opDelete
to support a new actionopDetach
: liukun@0a9a8f6Do you think it can be added as a feature of
gaio
? If so, I'll commit a PR later with more proper designs than the above commit.The text was updated successfully, but these errors were encountered: