Pārlūkot izejas kodu

Fix occasional error with sending while readyState !== 1

Under certain conditions, noVNC would attempt to flush the web socket
while it was disconnected, before the disconnected state was picked up.
This casues noVNC to crash ungracefully and the parent window is not
notified - leading to no chance at recovery without a page refresh.
Drew DeVault 10 gadi atpakaļ
vecāks
revīzija
f6a29ddeeb
1 mainītis faili ar 1 papildinājumiem un 1 dzēšanām
  1. 1 1
      include/websock.js

+ 1 - 1
include/websock.js

@@ -197,7 +197,7 @@ function Websock() {
             }
 
             if (this._websocket.bufferedAmount < this.maxBufferedAmount) {
-                if (this._sQlen > 0) {
+                if (this._sQlen > 0 && this._websocket.readyState === WebSocket.OPEN) {
                     this._websocket.send(this._encode_message());
                     this._sQlen = 0;
                 }