Skip to content
This repository was archived by the owner on Mar 6, 2018. It is now read-only.

Commit 91ccf13

Browse files
committed
Fixing crash when using xhr during disconnect
1 parent a4a215e commit 91ccf13

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/io/socket/IOConnection.java

+6-4
Original file line numberDiff line numberDiff line change
@@ -471,13 +471,15 @@ private void invalidateTransport() {
471471
/**
472472
* Reset timeout.
473473
*/
474-
private void resetTimeout() {
474+
private synchronized void resetTimeout() {
475475
if (heartbeatTimeoutTask != null) {
476476
heartbeatTimeoutTask.cancel();
477477
}
478-
heartbeatTimeoutTask = new HearbeatTimeoutTask();
479-
backgroundTimer.schedule(heartbeatTimeoutTask, closingTimeout
480-
+ heartbeatTimeout);
478+
if(getState() != STATE_INVALID) {
479+
heartbeatTimeoutTask = new HearbeatTimeoutTask();
480+
backgroundTimer.schedule(heartbeatTimeoutTask, closingTimeout
481+
+ heartbeatTimeout);
482+
}
481483
}
482484

483485
/**

0 commit comments

Comments
 (0)