mirror of
https://github.com/Xahau/xahau.js.git
synced 2025-11-19 19:55:51 +00:00
UT: Clean up and faster tearDown.
This commit is contained in:
committed by
Stefan Thomas
parent
7b4e77dd21
commit
ad227c344b
@@ -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();
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user