Closed
Description
Calling a network connection's File()
method prevents deadlines from working.
This won't timeout correctly:
c, _ := net.ListenUDP("udp", &net.UDPAddr{IP: net.IP{127, 0, 0, 1}, Port: 9999})
fmt.Println("timing out in 1s")
c.SetReadDeadline(time.Now().Add(time.Second))
// calling File() removes the ability to use deadlines
_, _ = c.File()
buf := make([]byte, 1024)
_, e := c.Read(buf)
fmt.Println(e)
It would be nice if deadlines still worked when a socket is in blocking mode, but if it's not possible this should at least be documented.