Skip to content

Commit

Permalink
feat(p2p): peerId protocol handshake
Browse files Browse the repository at this point in the history
  • Loading branch information
DEgITx committed May 9, 2018
1 parent bcc8e8f commit a216279
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/background/p2p.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ class p2p {
callback({
protocol: 'rats',
version: this.version,
peerId: this.peerId,
info: this.info,
peers: shuffle(this.peersList()).slice(0, 4).map(peer => ({address: peer.address, port: peer.port}))
})
Expand Down Expand Up @@ -241,6 +242,7 @@ class p2p {
protocol: 'rats',
port: config.spiderPort,
version: this.version,
peerId: this.peerId,
info: this.info,
peers: shuffle(this.peersList()).slice(0, 4).map(peer => ({address: peer.address, port: peer.port})).concat(this.externalPeers) // also add external peers
}, (data) => {
Expand All @@ -263,6 +265,7 @@ class p2p {
this.size++;
//extra info
address.version = data.version
address.peerId = data.peerId
address.info = data.info
this.send('peer', {
size: this.size,
Expand Down

0 comments on commit a216279

Please sign in to comment.