Skip to content

Commit

Permalink
add new peer addPeer
Browse files Browse the repository at this point in the history
  • Loading branch information
shimondoodkin committed Jun 26, 2014
1 parent 7f8d4ae commit 8135570
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions lib/telepathine.js
Expand Up @@ -253,6 +253,24 @@ Telepathine.prototype.start = function (callback) {
return this;
}


Telepathine.prototype.addPeer = function (toipandport) {
if (toipandport === this.peer_name)
{
if (debug.enabled) debug('cannot specify self as peer');
return false;
}
if(toipandport in this.peers)
{
if (debug.enabled) debug('peer already exists')
return false
}
var x={};x[toipandport]=undefined;
this.handleNewPeers(x);
return true;
};


/* force immediate broadcast and reset gossip timer
todo: optional parameter to skip immediate gossip if next gossip is below a duration threshold
*/
Expand Down

0 comments on commit 8135570

Please sign in to comment.