From ad227c344b925042082d5d9ea362fab1a9412f73 Mon Sep 17 00:00:00 2001 From: Arthur Britto Date: Sun, 14 Oct 2012 01:31:46 -0700 Subject: [PATCH] UT: Clean up and faster tearDown. --- js/remote.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/js/remote.js b/js/remote.js index 064dc81f..9825797f 100644 --- a/js/remote.js +++ b/js/remote.js @@ -165,6 +165,7 @@ Remote.prototype.connect_helper = function () { if (self.expire) { if (self.trace) console.log("remote: was expired"); + ws.onerror = undefined; self.done(ws.readyState); } else { @@ -300,15 +301,19 @@ Remote.prototype.connect = function (done, timeout) { }; // Target stated is disconnected. +// Note: if exiting or other side is going away, don't need to disconnect. Remote.prototype.disconnect = function (done) { var self = this; var ws = this.ws; + + if (self.trace) console.log("remote: disconnect"); ws.onclose = function () { if (self.trace) console.log("remote: onclose: %s", ws.readyState); done(ws.readyState); }; - + + // ws package has a hard coded 30 second timeout. ws.close(); };