summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorRyan Dahl <ry@tinyclouds.org>2011-12-21 12:17:23 -0800
committerRyan Dahl <ry@tinyclouds.org>2011-12-21 12:17:23 -0800
commitf7f8af842077be4e6cc580ddedcccea71e073bbb (patch)
tree2c2a6a881cd3cbcf04b0f338afb1c942d33bbb19 /lib
parent4eaf4ce26a0e66179d199997d9e0290867557702 (diff)
parent73cf8e82e768af870964d6f3375ab758e774165c (diff)
downloadnode-new-f7f8af842077be4e6cc580ddedcccea71e073bbb.tar.gz
Merge remote branch 'origin/v0.6'
Conflicts: Makefile lib/_debugger.js
Diffstat (limited to 'lib')
-rw-r--r--lib/child_process.js6
-rw-r--r--lib/net.js1
-rw-r--r--lib/path.js1
-rw-r--r--lib/timers.js7
-rw-r--r--lib/tls.js16
5 files changed, 27 insertions, 4 deletions
diff --git a/lib/child_process.js b/lib/child_process.js
index 8bcfdf74a0..cef093a0b7 100644
--- a/lib/child_process.js
+++ b/lib/child_process.js
@@ -111,7 +111,11 @@ function setupChannel(target, channel) {
};
target.send = function(message, sendHandle) {
- if (!target._channel) throw new Error('channel closed');
+ if (typeof message === 'undefined') {
+ throw new TypeError('message cannot be undefined');
+ }
+
+ if (!target._channel) throw new Error("channel closed");
// For overflow protection don't write if channel queue is too deep.
if (channel.writeQueueSize > 1024 * 1024) {
diff --git a/lib/net.js b/lib/net.js
index e182173953..d57d4c43e9 100644
--- a/lib/net.js
+++ b/lib/net.js
@@ -148,6 +148,7 @@ Socket.prototype.setTimeout = function(msecs, callback) {
Socket.prototype._onTimeout = function() {
+ debug("_onTimeout");
this.emit('timeout');
};
diff --git a/lib/path.js b/lib/path.js
index 03d0807f75..b70225b1d6 100644
--- a/lib/path.js
+++ b/lib/path.js
@@ -222,7 +222,6 @@ if (isWindows) {
return arr.slice(start, end - start + 1);
}
- var fromParts = trim(from.split('\\'));
var toParts = trim(to.split('\\'));
var lowerFromParts = trim(lowerFrom.split('\\'));
diff --git a/lib/timers.js b/lib/timers.js
index 39eb4d9161..35085e0c15 100644
--- a/lib/timers.js
+++ b/lib/timers.js
@@ -108,6 +108,8 @@ var unenroll = exports.unenroll = function(item) {
list.close();
delete lists[item._idleTimeout];
}
+ //if active is called later, then we want to make sure not to insert again
+ delete item._idleTimeout;
};
@@ -151,7 +153,10 @@ exports.setTimeout = function(callback, after) {
timer = new Timer();
if (arguments.length <= 2) {
- timer._onTimeout = callback;
+ timer._onTimeout = function() {
+ callback();
+ timer.close();
+ }
} else {
var args = Array.prototype.slice.call(arguments, 2);
timer._onTimeout = function() {
diff --git a/lib/tls.js b/lib/tls.js
index e4f332d415..47f2e0c54b 100644
--- a/lib/tls.js
+++ b/lib/tls.js
@@ -576,7 +576,6 @@ function SecurePair(credentials, isServer, requestCert, rejectUnauthorized,
requestCert = true;
}
- this._secureEstablished = false;
this._rejectUnauthorized = rejectUnauthorized ? true : false;
this._requestCert = requestCert ? true : false;
@@ -721,6 +720,7 @@ SecurePair.prototype.maybeInitFinished = function() {
SecurePair.prototype.destroy = function() {
var self = this;
+ var error = this.ssl.error;
if (!this._doneFlag) {
this._doneFlag = true;
@@ -736,6 +736,14 @@ SecurePair.prototype.destroy = function() {
self.encrypted.emit('close');
self.cleartext.emit('close');
});
+
+ if (!this._secureEstablished) {
+ if (!error) {
+ error = new Error('socket hang up');
+ error.code = 'ECONNRESET';
+ }
+ this.emit('error', error);
+ }
}
};
@@ -905,6 +913,9 @@ function Server(/* [options], listener */) {
}
}
});
+ pair.on('error', function(err) {
+ self.emit('clientError', err);
+ });
});
if (listener) {
@@ -1061,6 +1072,9 @@ exports.connect = function(port /* host, options, cb */) {
cleartext.emit('secureConnect');
}
});
+ pair.on('error', function(err) {
+ cleartext.emit('error', err);
+ });
cleartext._controlReleased = true;
return cleartext;