net_uv: Don't add listenerCallback when null

This commit is contained in:
Ryan Dahl 2011-06-20 14:48:00 +02:00
parent 5c38163787
commit d0a9e64245

View File

@ -359,20 +359,19 @@ function Server(/* [ options, ] listener */) {
var self = this;
var options, listenerCallback;
var options;
if (typeof arguments[0] == 'function') {
options = {};
listenerCallback = arguments[0];
self.on('connection', arguments[0]);
} else {
options = arguments[0];
if (typeof arguments[1] == 'function') {
listenerCallback = arguments[1];
self.on('connection', arguments[1]);
}
}
this.on('connection', listenerCallback);
this.connections = 0;
this.allowHalfOpen = options.allowHalfOpen || false;