Merge pull request #321 from jscharlach/master

Checking connection state prior to resetting close timeout
This commit is contained in:
Guillermo Rauch
2011-10-26 20:23:03 -07:00

View File

@@ -1,4 +1,3 @@
/**
* socket.io
* Copyright(c) 2011 LearnBoost <dev@learnboost.com>
@@ -42,7 +41,13 @@
Transport.prototype.onData = function (data) {
this.clearCloseTimeout();
this.setCloseTimeout();
// If the connection in currently open (or in a reopening state) reset the close
// timeout since we have just received data. This check is necessary so
// that we don't reset the timeout on an explicitly disconnected connection.
if (this.connected || this.connecting || this.reconnecting) {
this.setCloseTimeout();
}
if (data !== '') {
// todo: we should only do decodePayload for xhr transports