Browse files

Ensured we emit the event _after_ we we call `onPacket`.

This prevents a race condition where upon `poll`, the transport
gets paused, then upon getting closed upgraded (therefore replaced)
and packets are lost!
  • Loading branch information...
1 parent ce02ec2 commit 5f0d2455d3da2310b74fff2975f96fff0c4c2877 @rauchg rauchg committed Jan 15, 2012
Showing with 4 additions and 0 deletions.
  1. +4 −0 lib/transports/polling.js
View
4 lib/transports/polling.js
@@ -133,6 +133,10 @@ Polling.prototype.onData = function (data) {
this.onPacket(packets[i]);
}
+ // if we got data we're not polling
+ this.polling = false;
+ this.emit('poll');
+
if ('open' == this.readyState) {
this.poll();
} else {

0 comments on commit 5f0d245

Please sign in to comment.