mirror of
https://github.com/socketio/socket.io.git
synced 2026-04-30 03:00:39 -04:00
fix for broken closeTimeout and 'IE + xhr' goes into infinite loop on disconnection
This commit is contained in:
@@ -45,7 +45,7 @@
|
||||
// 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) {
|
||||
if (this.socket.connected || this.socket.connecting || this.socket.reconnecting) {
|
||||
this.setCloseTimeout();
|
||||
}
|
||||
|
||||
|
||||
@@ -88,14 +88,20 @@
|
||||
|
||||
function onload () {
|
||||
this.onload = empty;
|
||||
this.onerror = empty;
|
||||
self.onData(this.responseText);
|
||||
self.get();
|
||||
};
|
||||
|
||||
function onerror () {
|
||||
self.onClose();
|
||||
};
|
||||
|
||||
this.xhr = this.request();
|
||||
|
||||
if (global.XDomainRequest && this.xhr instanceof XDomainRequest) {
|
||||
this.xhr.onload = this.xhr.onerror = onload;
|
||||
this.xhr.onload = onload;
|
||||
this.xhr.onerror = onerror;
|
||||
} else {
|
||||
this.xhr.onreadystatechange = stateChange;
|
||||
}
|
||||
@@ -113,7 +119,7 @@
|
||||
io.Transport.XHR.prototype.onClose.call(this);
|
||||
|
||||
if (this.xhr) {
|
||||
this.xhr.onreadystatechange = this.xhr.onload = empty;
|
||||
this.xhr.onreadystatechange = this.xhr.onload = this.xhr.onerror = empty;
|
||||
try {
|
||||
this.xhr.abort();
|
||||
} catch(e){}
|
||||
|
||||
Reference in New Issue
Block a user