fix indentation

This commit is contained in:
Afshin Mehrabani
2012-08-20 23:21:35 +04:30
parent 9073a07323
commit ab4393fbd8
2 changed files with 15 additions and 16 deletions

View File

@@ -212,7 +212,7 @@ Socket.prototype.clearTransport = function () {
Socket.prototype.onClose = function (reason, description) {
if ('closed' != this.readyState) {
this.packetsFn = {};
this.packetsFn = {};
this.packetSeq = 0;
this.clearTransport();
this.readyState = 'closed';
@@ -231,9 +231,9 @@ Socket.prototype.setupSendCallback = function () {
//the message was sent successfully, execute the callback
this.transport.on("drain", function(seq){
if('function' == typeof self.packetsFn[seq]) {
debug('executing send callback');
self.packetsFn[seq](self.transport);
delete self.packetsFn[seq];
debug('executing send callback');
self.packetsFn[seq](self.transport);
delete self.packetsFn[seq];
}
});
};

View File

@@ -99,15 +99,14 @@ Polling.prototype.onPollRequest = function (req, res) {
this.writable = true;
//decide to send empty `drain` or not
if(req.query.sid && this.writable && this.seqIds.length > 0){
debug("acks received from client, emit drain")
var singleItem = this.seqIds.splice(0,1);
for (var i = 0, l = singleItem[0].length; i < l; ++i) {
this.emit('drain', singleItem[0][i]);
}
if (req.query.sid && this.writable && this.seqIds.length > 0) {
debug("acks received from client, emit drain");
var singleItem = this.seqIds.splice(0,1);
for (var i = 0, l = singleItem[0].length; i < l; ++i) {
this.emit('drain', singleItem[0][i]);
}
} else {
this.emit('drain');
this.emit('drain');
}
// if we're still writable but had a pending close, trigger an empty send
@@ -209,11 +208,11 @@ Polling.prototype.send = function (packets) {
}
var pushTo = [];
for (var i = 0, l = packets.length; i < l; ++i) {
if(typeof packets[i].seq != "undefined" && packets[i].type == "message") {
pushTo.push(packets[i].seq);
}
if (typeof packets[i].seq != "undefined" && packets[i].type == "message") {
pushTo.push(packets[i].seq);
}
}
if(pushTo.length > 0) this.seqIds.push(pushTo);
if (pushTo.length > 0) this.seqIds.push(pushTo);
this.write(parser.encodePayload(packets));
};