|
|
@ -418,6 +418,7 @@ exports.createClient = function (port, host) { |
|
|
|
var secure_credentials={ secure : false }; |
|
|
|
|
|
|
|
var requests = []; |
|
|
|
var currentRequest; |
|
|
|
|
|
|
|
client._pushRequest = function (req) { |
|
|
|
req.addListener("flush", function () { |
|
|
@ -434,7 +435,7 @@ exports.createClient = function (port, host) { |
|
|
|
return; |
|
|
|
} |
|
|
|
//sys.debug("client flush readyState = " + client.readyState);
|
|
|
|
if (req == requests[0]) flushMessageQueue(client, [req]); |
|
|
|
if (req == currentRequest) flushMessageQueue(client, [req]); |
|
|
|
}); |
|
|
|
requests.push(req); |
|
|
|
}; |
|
|
@ -451,7 +452,8 @@ exports.createClient = function (port, host) { |
|
|
|
|
|
|
|
client.addListener("connect", function () { |
|
|
|
client.resetParser(); |
|
|
|
requests[0].flush(); |
|
|
|
currentRequest = requests.shift(); |
|
|
|
currentRequest.flush(); |
|
|
|
}); |
|
|
|
|
|
|
|
client.addListener("eof", function () { |
|
|
@ -489,8 +491,7 @@ exports.createClient = function (port, host) { |
|
|
|
client.close(); |
|
|
|
}); |
|
|
|
|
|
|
|
var req = requests.shift(); |
|
|
|
req.emit("response", res); |
|
|
|
currentRequest.emit("response", res); |
|
|
|
}); |
|
|
|
|
|
|
|
return client; |
|
|
|