Fix disconnect/reconnect issues

Commit 155d78b399 prevented reconnections
from working properly.  This fixes that by creating a new RFB object
after disconnecting or failing.

Furthermore, this ensures that a new connection cannot be opened util
we've actually disconnected (either by timer or by receiving a `close`
event).

Closes #452
This commit is contained in:
Solly Ross
2015-02-20 17:27:27 -05:00
parent fe8a4dc9d8
commit e543525faa
2 changed files with 26 additions and 10 deletions

View File

@@ -482,6 +482,7 @@ var RFB;
Util.Debug("Clearing disconnect timer");
clearTimeout(this._disconnTimer);
this._disconnTimer = null;
this._sock.off('close'); // make sure we don't get a double event
}
switch (state) {