summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorRyan Dahl <ry@tinyclouds.org>2011-01-12 10:57:01 -0800
committerRyan Dahl <ry@tinyclouds.org>2011-01-12 10:57:03 -0800
commit33c33949b2965512e6e058e6e1e5c800a617d071 (patch)
treed66da55b65ae48c3f0c6d033db696719d2424010 /lib
parent72589b60ada148467caa42912585316cde0ce3e8 (diff)
downloadnode-new-33c33949b2965512e6e058e6e1e5c800a617d071.tar.gz
Add test for connection timeouts
Also make socket.end() destroy connection if still trying to connect. Previously was ignoring.
Diffstat (limited to 'lib')
-rw-r--r--lib/net.js4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/net.js b/lib/net.js
index 8dbdecd360..facb975ff0 100644
--- a/lib/net.js
+++ b/lib/net.js
@@ -783,7 +783,9 @@ Socket.prototype._shutdown = function() {
Socket.prototype.end = function(data, encoding) {
- if (this.writable) {
+ if (this._connecting) {
+ this.destroy();
+ } else if (this.writable) {
if (this._writeQueueLast() !== END_OF_FILE) {
if (data) this.write(data, encoding);
this._writeQueue.push(END_OF_FILE);