Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
net: TCPListener.SetDeadline doesn't work on Windows #4296
What steps will reproduce the problem? If possible, include a link to a program on play.golang.org. 1. Create a TCP listener 2. Set the listener's deadline to sometime in the future e.g. time.Now().Add(2 * time.Second) 3. Try to Accept a connection Sample program - https://gist.github.com/3967375 What is the expected output? The program should exit after 2 seconds or so. What do you see instead? The program blocks and doesn't exit. Which compiler are you using (5g, 6g, 8g, gccgo)? 6g Which operating system are you using? Windows 7 x64 Which version are you using? (run 'go version') 1.0.3 Please provide any additional information below. Original thread here - https://groups.google.com/forum/?fromgroups=#!topic/golang-nuts/TVO13oA0Fvc
It seems to me that the fix is simple, in src/pkg/net/fd_windows.go look for iosrv.ExecIO in accept and change second parameter from 0 to fd.rdeadline. Then after deadline it would return: AcceptEx tcp 127.0.0.1:31432: resource temporarily unavailable And this is what's strange, because it should probably return some form of timeout?
This issue was closed.