|
@@ -139,10 +139,9 @@ Peer.prototype._socketInit = function() {
|
|
this._socket.onopen = function() {
|
|
this._socket.onopen = function() {
|
|
util.log('Socket open');
|
|
util.log('Socket open');
|
|
self._socketOpen = true;
|
|
self._socketOpen = true;
|
|
- for (var connection in self.connections) {
|
|
|
|
- if (self.connections.hasOwnProperty(connection)) {
|
|
|
|
- self.connections[connection].setSocketOpen();
|
|
|
|
- }
|
|
|
|
|
|
+ var ids = Object.keys(self.connections)
|
|
|
|
+ for (var i = 0, ii = ids.length; i < ii; i += 1) {
|
|
|
|
+ self.connections[ids[i]].setSocketOpen();
|
|
}
|
|
}
|
|
if (self._id)
|
|
if (self._id)
|
|
self._processQueue();
|
|
self._processQueue();
|
|
@@ -254,7 +253,7 @@ Peer.prototype.connect = function(peer, metadata, cb) {
|
|
this.connections[peer] = connection;
|
|
this.connections[peer] = connection;
|
|
};
|
|
};
|
|
|
|
|
|
-Peer.prototype.leave = function() {
|
|
|
|
|
|
+Peer.prototype.destroy = function() {
|
|
this._cleanup();
|
|
this._cleanup();
|
|
};
|
|
};
|
|
|
|
|