net: implement peer ids.
This commit is contained in:
parent
028fee9eee
commit
0b13452df1
@ -391,7 +391,6 @@ RPC.prototype.getNetTotals = co(function* getNetTotals(args, help) {
|
||||
|
||||
RPC.prototype.getPeerInfo = co(function* getPeerInfo(args, help) {
|
||||
var peers = [];
|
||||
var id = 0;
|
||||
var peer, offset;
|
||||
|
||||
if (help || args.length !== 0)
|
||||
@ -404,7 +403,7 @@ RPC.prototype.getPeerInfo = co(function* getPeerInfo(args, help) {
|
||||
offset = 0;
|
||||
|
||||
peers.push({
|
||||
id: id++,
|
||||
id: peer.id,
|
||||
addr: peer.hostname(),
|
||||
addrlocal: !peer.local.isNull()
|
||||
? peer.local.hostname
|
||||
|
||||
@ -79,6 +79,7 @@ function Peer(options) {
|
||||
this.parser = new Parser(this.network);
|
||||
this.framer = new Framer(this.network);
|
||||
|
||||
this.id = Peer.uid++;
|
||||
this.socket = null;
|
||||
this.opened = false;
|
||||
this.outbound = false;
|
||||
@ -148,6 +149,13 @@ function Peer(options) {
|
||||
|
||||
util.inherits(Peer, EventEmitter);
|
||||
|
||||
/**
|
||||
* Peer ID counter.
|
||||
* @type {Number}
|
||||
*/
|
||||
|
||||
Peer.uid = 0;
|
||||
|
||||
/**
|
||||
* Max output bytes buffered before
|
||||
* invoking stall behavior for peer.
|
||||
|
||||
Loading…
Reference in New Issue
Block a user