Fix PeerServer API bugs

This commit is contained in:
Starbeamrainbowlabs 2022-01-09 17:02:26 +00:00
parent 63b698573f
commit e4c01ae828
Signed by: sbrl
GPG key ID: 1BE5172E637709C2
2 changed files with 3 additions and 2 deletions

View file

@ -54,7 +54,8 @@ class Agent {
await this.server.add_peers(...this.config.peers.map( await this.server.add_peers(...this.config.peers.map(
peer => parse_peer_name(peer) peer => parse_peer_name(peer)
)); ));
l.log(`Added ${this.config.peers.length} initial peers`);
l.log(`Added ${this.server.peers().length} / ${this.config.peers.length} initial peers`);
if(this.config.peers.length < 1) if(this.config.peers.length < 1)
l.warn(`No initial peers were specified! It's recommended that you specify at least 1 on every host.`); l.warn(`No initial peers were specified! It's recommended that you specify at least 1 on every host.`);
} }

View file

@ -103,7 +103,7 @@ class PeerServer extends EventEmitter {
*/ */
peers() { peers() {
return this.connected_peers.map((peer) => peer.remote_endpoint) return this.connected_peers.map((peer) => peer.remote_endpoint)
.filter(el => typeof el.addr === "string" && typeof el.port === "number"); .filter(el => typeof el.address === "string" && typeof el.port === "number");
} }
/** /**