Skip to content
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

net: TCPListener.SetDeadline doesn't work on Windows #4296

Closed
gopherbot opened this issue Oct 28, 2012 · 6 comments

Comments

Projects
None yet
5 participants
@gopherbot
Copy link

commented Oct 28, 2012

by liamzebedee:

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
@snaury

This comment has been minimized.

Copy link
Contributor

commented Oct 28, 2012

Comment 1:

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?
@snaury

This comment has been minimized.

Copy link
Contributor

commented Oct 28, 2012

Comment 2:

Ah, no, it's same as with other calls, so it seems to work as expected.
@snaury

This comment has been minimized.

Copy link
Contributor

commented Oct 28, 2012

Comment 3:

Submitted CL at https://golang.org/cl/6815044
@davecheney

This comment has been minimized.

Copy link
Contributor

commented Oct 28, 2012

Comment 4:

Status changed to Started.

@alexbrainman

This comment has been minimized.

Copy link
Member

commented Oct 29, 2012

Comment 5:

snaury,
I agree with you, the "resource temporarily unavailable" is misleading. I am planning to
change it once https://golang.org/cl/6604072/ is submitted.
Alex
@alexbrainman

This comment has been minimized.

Copy link
Member

commented Oct 30, 2012

Comment 6:

This issue was closed by revision d12a7d3.

Status changed to Fixed.

@rsc rsc added this to the Go1.1 milestone Apr 14, 2015

@rsc rsc removed the go1.1 label Apr 14, 2015

@golang golang locked and limited conversation to collaborators Jun 24, 2016

This issue was closed.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
You can’t perform that action at this time.