refactor: move hashQueryRoutingTable to S5Node
This commit is contained in:
parent
d07351a928
commit
8091e7ab36
|
@ -57,7 +57,8 @@ export default async function (
|
||||||
config: node.config,
|
config: node.config,
|
||||||
});
|
});
|
||||||
|
|
||||||
const list = p2p.hashQueryRoutingTable.get(hash) || new Set<NodeId>();
|
const list =
|
||||||
|
node.hashQueryRoutingTable.get(hash.hashCode) || new Set<NodeId>();
|
||||||
for (const peerId of list) {
|
for (const peerId of list) {
|
||||||
if (peerId.equals(nodeId)) {
|
if (peerId.equals(nodeId)) {
|
||||||
continue;
|
continue;
|
||||||
|
@ -74,5 +75,5 @@ export default async function (
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
p2p.hashQueryRoutingTable.delete(hash);
|
node.hashQueryRoutingTable.delete(hash.hashCode);
|
||||||
}
|
}
|
||||||
|
|
|
@ -50,6 +50,12 @@ export class S5Node {
|
||||||
|
|
||||||
private _started = false;
|
private _started = false;
|
||||||
|
|
||||||
|
private _hashQueryRoutingTable: Map<number, Set<NodeId>> = new Map();
|
||||||
|
|
||||||
|
get hashQueryRoutingTable(): Map<number, Set<NodeId>> {
|
||||||
|
return this._hashQueryRoutingTable;
|
||||||
|
}
|
||||||
|
|
||||||
get started(): boolean {
|
get started(): boolean {
|
||||||
return this._started;
|
return this._started;
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,13 +48,6 @@ export class P2PService extends EventEmitter {
|
||||||
|
|
||||||
node.services.p2p = this;
|
node.services.p2p = this;
|
||||||
}
|
}
|
||||||
|
|
||||||
private _hashQueryRoutingTable: Map<Multihash, Set<NodeId>> = new Map();
|
|
||||||
|
|
||||||
get hashQueryRoutingTable(): Map<Multihash, Set<NodeId>> {
|
|
||||||
return this._hashQueryRoutingTable;
|
|
||||||
}
|
|
||||||
|
|
||||||
private _networkId?: string;
|
private _networkId?: string;
|
||||||
|
|
||||||
get networkId(): string {
|
get networkId(): string {
|
||||||
|
|
Loading…
Reference in New Issue