Permalink
Browse files

add new peer addPeer

  • Loading branch information...
1 parent 7f8d4ae commit 8135570bb1bbb19b496aa4982aa32a9d83eca8c2 @shimondoodkin committed Jun 26, 2014
Showing with 18 additions and 0 deletions.
  1. +18 −0 lib/telepathine.js
View
@@ -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
*/

0 comments on commit 8135570

Please sign in to comment.