Don't use sys.debug, it gets preprocessed out
Problem introduced in b29f78772e
This commit is contained in:
Родитель
903977d5e8
Коммит
ebe2721cbf
23
lib/http.js
23
lib/http.js
|
@ -1,3 +1,12 @@
|
|||
var debugLevel = 0;
|
||||
if ("NODE_DEBUG" in process.env) debugLevel = 1;
|
||||
|
||||
function debug (x) {
|
||||
if (debugLevel > 0) {
|
||||
process.binding('stdio').writeError(x + "\n");
|
||||
}
|
||||
}
|
||||
|
||||
var sys = require('sys');
|
||||
var net = require('net');
|
||||
var events = require('events');
|
||||
|
@ -534,7 +543,7 @@ function Client ( ) {
|
|||
|
||||
self._reconnect = function () {
|
||||
if (self.readyState != "opening") {
|
||||
sys.debug("HTTP CLIENT: reconnecting readyState = " + self.readyState);
|
||||
debug("HTTP CLIENT: reconnecting readyState = " + self.readyState);
|
||||
self.connect(self.port, self.host);
|
||||
}
|
||||
};
|
||||
|
@ -542,12 +551,12 @@ function Client ( ) {
|
|||
self._pushRequest = function (req) {
|
||||
req.addListener("flush", function () {
|
||||
if (self.readyState == "closed") {
|
||||
sys.debug("HTTP CLIENT request flush. reconnect. readyState = " + self.readyState);
|
||||
debug("HTTP CLIENT request flush. reconnect. readyState = " + self.readyState);
|
||||
self._reconnect();
|
||||
return;
|
||||
}
|
||||
|
||||
sys.debug("self flush readyState = " + self.readyState);
|
||||
debug("self flush readyState = " + self.readyState);
|
||||
if (req == currentRequest) flushMessageQueue(self, [req]);
|
||||
});
|
||||
requests.push(req);
|
||||
|
@ -568,7 +577,7 @@ function Client ( ) {
|
|||
parser.finish();
|
||||
freeParser(parser);
|
||||
|
||||
//sys.debug("self got end closing. readyState = " + self.readyState);
|
||||
debug("self got end closing. readyState = " + self.readyState);
|
||||
self.close();
|
||||
});
|
||||
|
||||
|
@ -578,7 +587,7 @@ function Client ( ) {
|
|||
return;
|
||||
}
|
||||
|
||||
sys.debug("HTTP CLIENT onClose. readyState = " + self.readyState);
|
||||
debug("HTTP CLIENT onClose. readyState = " + self.readyState);
|
||||
|
||||
// If there are more requests to handle, reconnect.
|
||||
if (requests.length > 0) {
|
||||
|
@ -587,10 +596,10 @@ function Client ( ) {
|
|||
});
|
||||
|
||||
parser.onIncoming = function (res) {
|
||||
sys.debug("incoming response!");
|
||||
debug("incoming response!");
|
||||
|
||||
res.addListener('end', function ( ) {
|
||||
//sys.debug("request complete disconnecting. readyState = " + self.readyState);
|
||||
debug("request complete disconnecting. readyState = " + self.readyState);
|
||||
self.close();
|
||||
});
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче