Timeout connection.

This commit is contained in:
Joel Martin 2010-06-18 15:18:41 -05:00
parent 146071161f
commit 2a4e7d8a93
1 changed files with 8 additions and 0 deletions

View File

@ -64,6 +64,7 @@ true_color : false,
b64encode : true, // false means UTF-8 on the wire
//b64encode : false, // false means UTF-8 on the wire
connectTimeout : 1000, // time to wait for connection
// In preference order
@ -1476,6 +1477,13 @@ init_ws: function () {
console.error("<< WebSocket.onerror");
};
setTimeout(function () {
if (RFB.ws.readyState === WebSocket.CONNECTING) {
RFB.updateState('failed', "Connect timeout");
RFB.ws.close();
}
}, RFB.connectTimeout);
//console.log("<< init_ws");
},