mirror of
https://github.com/socketio/socket.io.git
synced 2026-04-30 03:00:39 -04:00
Merge pull request #321 from jscharlach/master
Checking connection state prior to resetting close timeout
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user