net: Setting a deadline to a net.TCPConn has no effect if there was a "File()" method call. #7605
Labels
Comments
Comment 1 by ilarkin@crystalnix.com: Switching to nonblock mode for new fd can solve this issue: > syscall.SetNonblock(int(f.Fd()), true) Is it necessary to block the original fd during duplicate creation? |
See dup and/or fcntl online manual. The duplicated file descritor will point the original file entry, and some attributes/flags bound to the original file entry will be shared. In this case, you need to do the following: 1) f2, err := c1.(*net.TCPConn).File() 2) c1.Close() 3) tweak attrs/flags via f2 4) c2, err := net.FileConn(f2) 5) f2.Close() 6) use c2 for network IO Status changed to WorkingAsIntended. |
This issue was closed.
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
by ilarkin@crystalnix.com:
The text was updated successfully, but these errors were encountered: