Permalink
Browse files

torrent_context, torrent_manager: randomize peerIds

  • Loading branch information...
1 parent b8eb39d commit c04fd247e91ba75db3e3823eca29aadf3d6cfc71 @astro astro committed Aug 29, 2010
Showing with 7 additions and 2 deletions.
  1. +4 −1 torrent_context.js
  2. +3 −1 torrent_manager.js
View
@@ -374,5 +374,8 @@ function parsePeers(data) {
}
function generatePeerId() {
- return new Buffer("-BS00-YOYOYOYOYOYOY0");
+ var peerId = new Buffer("-BS00- ");
+ for(var i = 6; i < 20; i++)
+ peerId[i] = Math.ceil(Math.random * 255);
+ return peerId;
}
View
@@ -55,7 +55,9 @@ setInterval(function() {
/**
* Wire listening stuff
*/
-var peerId = new Buffer("-BS00-YOYOYOYOYOYOY0");
+var peerId = new Buffer("-BS00- ");
+for(var i = 6; i < 20; i++)
+ peerId[i] = Math.ceil(Math.random * 255);
function checkInfoHash(infoHash) {
var infoHex = binToHex(infoHash);

0 comments on commit c04fd24

Please sign in to comment.