Skip to content

Commit

Permalink
clear websocket attribute without waiting for previous websocket to f…
Browse files Browse the repository at this point in the history
…inish closing

which may never finish
  • Loading branch information
minrk committed Jan 13, 2017
1 parent 3fb26ad commit 255ae89
Showing 1 changed file with 6 additions and 11 deletions.
17 changes: 6 additions & 11 deletions notebook/static/services/kernels/kernel.js
Original file line number Diff line number Diff line change
Expand Up @@ -576,18 +576,13 @@ define([
*
* @function stop_channels
*/
var that = this;
var close = function () {
if (that.ws && that.ws.readyState === WebSocket.CLOSED) {
that.ws = null;
}
};
if (this.ws !== null) {
if (this.ws.readyState === WebSocket.OPEN) {
this.ws.onclose = close;
this.ws.close();
} else {
close();
var ws = this.ws;
this.ws = null;
if (ws.readyState === WebSocket.OPEN) {
// unregister onclose callbacks
ws.onclose = function () {};
ws.close();
}
}
};
Expand Down

0 comments on commit 255ae89

Please sign in to comment.