From 6ebc477449ca8893a2e5e37310575e0c5e7dc444 Mon Sep 17 00:00:00 2001 From: Derrick Hammer Date: Thu, 31 Aug 2023 06:49:33 -0400 Subject: [PATCH] fix: add getter for networkId and hashQueryRoutingTable --- src/service/p2p.ts | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/src/service/p2p.ts b/src/service/p2p.ts index 698c871..cf69567 100644 --- a/src/service/p2p.ts +++ b/src/service/p2p.ts @@ -31,24 +31,34 @@ export class P2PService { private logger: Logger; private nodeKeyPair: KeyPairEd25519; private localNodeId?: NodeId; - private networkId?: string; private nodesDb?: AbstractSublevel< AbstractLevel, Uint8Array, string, Uint8Array >; - private hashQueryRoutingTable: Map> = new Map(); constructor(node: S5Node) { this._node = node; - this.networkId = node.config.p2p?.network; + this._networkId = node.config.p2p?.network; this.nodeKeyPair = node.config.keyPair; this.logger = node.logger; node.config.services.p2p = this; } + private _hashQueryRoutingTable: Map> = new Map(); + + get hashQueryRoutingTable(): Map> { + return this._hashQueryRoutingTable; + } + + private _networkId?: string; + + get networkId(): string { + return this._networkId as string; + } + private _node: S5Node; get node(): S5Node { @@ -92,8 +102,8 @@ export class P2PService { const initialAuthPayloadPacker = new Packer(); initialAuthPayloadPacker.packInt(protocolMethodHandshakeOpen); initialAuthPayloadPacker.packBinary(Buffer.from(peer.challenge)); - if (this.networkId) { - initialAuthPayloadPacker.packString(this.networkId); + if (this._networkId) { + initialAuthPayloadPacker.packString(this._networkId); } const completer = defer();