|
@@ -345,7 +345,7 @@ PeerServer.prototype._processOutstanding = function(key, id) {
|
|
|
};
|
|
|
|
|
|
PeerServer.prototype._removePeer = function(key, id) {
|
|
|
- if (this._clients[key][id]) {
|
|
|
+ if (this._clients[key] && this._clients[key][id]) {
|
|
|
this._ips[this._clients[key][id].ip]--;
|
|
|
delete this._clients[key][id];
|
|
|
}
|
|
@@ -405,6 +405,9 @@ PeerServer.prototype._handleTransmission = function(key, message) {
|
|
|
|
|
|
PeerServer.prototype._generateClientId = function(key) {
|
|
|
var clientId = util.randomId();
|
|
|
+ if (!this._clients[key]) {
|
|
|
+ return clientId;
|
|
|
+ }
|
|
|
while (!!this._clients[key][clientId]) {
|
|
|
clientId = util.randomId();
|
|
|
}
|