From ab4393fbd81a25e49d045c2fd7fa4cbdb006a715 Mon Sep 17 00:00:00 2001 From: Afshin Mehrabani Date: Mon, 20 Aug 2012 23:21:35 +0430 Subject: [PATCH] fix indentation --- lib/socket.js | 8 ++++---- lib/transports/polling.js | 23 +++++++++++------------ 2 files changed, 15 insertions(+), 16 deletions(-) diff --git a/lib/socket.js b/lib/socket.js index a24af9ce..03872ae6 100644 --- a/lib/socket.js +++ b/lib/socket.js @@ -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]; } }); }; diff --git a/lib/transports/polling.js b/lib/transports/polling.js index 549358ac..5b547577 100644 --- a/lib/transports/polling.js +++ b/lib/transports/polling.js @@ -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)); };