|
|
@ -1,5 +1,7 @@ |
|
|
|
var sys = require("sys"); |
|
|
|
var fs = require("fs"); |
|
|
|
var events = require("events"); |
|
|
|
|
|
|
|
var debugLevel = 0; |
|
|
|
if ('NODE_DEBUG' in process.ENV) debugLevel = 1; |
|
|
|
function debug (x) { |
|
|
@ -8,30 +10,33 @@ function debug (x) { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
var binding = process.binding('net'); |
|
|
|
|
|
|
|
|
|
|
|
var Buffer = process.Buffer; |
|
|
|
var IOWatcher = process.IOWatcher; |
|
|
|
var assert = process.assert; |
|
|
|
var socket = process.socket; |
|
|
|
var bind = process.bind; |
|
|
|
var connect = process.connect; |
|
|
|
var listen = process.listen; |
|
|
|
var accept = process.accept; |
|
|
|
var close = process.close; |
|
|
|
var shutdown = process.shutdown; |
|
|
|
var read = process.read; |
|
|
|
var recvMsg = process.recvMsg; |
|
|
|
var sendFD = process.sendFD; |
|
|
|
var write = process.write; |
|
|
|
var toRead = process.toRead; |
|
|
|
var setNoDelay = process.setNoDelay; |
|
|
|
var socketError = process.socketError; |
|
|
|
var getsockname = process.getsockname; |
|
|
|
var getaddrinfo = process.getaddrinfo; |
|
|
|
var needsLookup = process.needsLookup; |
|
|
|
var errnoException = process.errnoException; |
|
|
|
var EINPROGRESS = process.EINPROGRESS; |
|
|
|
var ENOENT = process.ENOENT; |
|
|
|
|
|
|
|
var socket = binding.socket; |
|
|
|
var bind = binding.bind; |
|
|
|
var connect = binding.connect; |
|
|
|
var listen = binding.listen; |
|
|
|
var accept = binding.accept; |
|
|
|
var close = binding.close; |
|
|
|
var shutdown = binding.shutdown; |
|
|
|
var read = binding.read; |
|
|
|
var recvMsg = binding.recvMsg; |
|
|
|
var sendFD = binding.sendFD; |
|
|
|
var write = binding.write; |
|
|
|
var toRead = binding.toRead; |
|
|
|
var setNoDelay = binding.setNoDelay; |
|
|
|
var socketError = binding.socketError; |
|
|
|
var getsockname = binding.getsockname; |
|
|
|
var getaddrinfo = binding.getaddrinfo; |
|
|
|
var needsLookup = binding.needsLookup; |
|
|
|
var errnoException = binding.errnoException; |
|
|
|
var EINPROGRESS = binding.EINPROGRESS; |
|
|
|
var ENOENT = binding.ENOENT; |
|
|
|
var END_OF_FILE = 0; |
|
|
|
|
|
|
|
|
|
|
@ -357,7 +362,7 @@ function initSocket (self) { |
|
|
|
} |
|
|
|
|
|
|
|
function Socket (fd) { |
|
|
|
process.EventEmitter.call(this); |
|
|
|
events.EventEmitter.call(this); |
|
|
|
|
|
|
|
this.fd = null; |
|
|
|
|
|
|
@ -372,7 +377,7 @@ function Socket (fd) { |
|
|
|
this.writable = true; |
|
|
|
} |
|
|
|
}; |
|
|
|
sys.inherits(Socket, process.EventEmitter); |
|
|
|
sys.inherits(Socket, events.EventEmitter); |
|
|
|
exports.Socket = Socket; |
|
|
|
|
|
|
|
|
|
|
@ -750,7 +755,7 @@ Socket.prototype.close = function () { |
|
|
|
|
|
|
|
|
|
|
|
function Server (listener) { |
|
|
|
process.EventEmitter.call(this); |
|
|
|
events.EventEmitter.call(this); |
|
|
|
var self = this; |
|
|
|
|
|
|
|
if (listener) { |
|
|
@ -778,7 +783,7 @@ function Server (listener) { |
|
|
|
} |
|
|
|
}; |
|
|
|
} |
|
|
|
sys.inherits(Server, process.EventEmitter); |
|
|
|
sys.inherits(Server, events.EventEmitter); |
|
|
|
exports.Server = Server; |
|
|
|
|
|
|
|
|
|
|
|