This repository has been archived by the owner on Apr 22, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 7.3k
socket.setTimeout malfunction when timeout is string #8618
Labels
Comments
@weihua44 are you able to try this commit - cjihrig/node@7f3261c? It seems to fix the problem on my end. |
@cjihrig Thanks, it works. And you taught me another way to change string to number ;-) |
@cjihrig Is this something that should be merged? |
@trevnorris there was some back and forth on the best way to fix bad timeout values. The most current fix for this is #8884 |
@cjihrig Thanks. Commented on that. |
cjihrig
added a commit
that referenced
this issue
Jan 22, 2015
This commit restricts socket timeouts non-negative, finite numbers. Any other value throws a TypeError or RangeError. This prevents subtle bugs that can happen due to type coercion. Fixes: #8618 PR-URL: #8884 Reviewed-By: Trevor Norris <[email protected]> Reviewed-By: Timothy J Fontaine <[email protected]>
Closed in f347573 |
cjihrig
added a commit
to nodejs/node
that referenced
this issue
Feb 13, 2015
This commit restricts socket timeouts non-negative, finite numbers. Any other value throws a TypeError or RangeError. This prevents subtle bugs that can happen due to type coercion. Fixes: nodejs/node-v0.x-archive#8618 PR-URL: nodejs/node-v0.x-archive#8884 Reviewed-By: Trevor Norris <[email protected]> Reviewed-By: Timothy J Fontaine <[email protected]> Conflicts: lib/timers.js test/simple/test-net-settimeout.js test/simple/test-net-socket-timeout.js
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Test the following code,
node tst
telnet localhost 10015, the connection will be lost in 1 second
telnet locahost 10016 then telnet localhost 10015, the connection will not be lost (it means the timeout event is failed for some reason)
If you change the var "to" from string to int, the timeout will always working.
The text was updated successfully, but these errors were encountered: