Skip to content

Commit

Permalink
fix: dont send signalling requests for a seed node
Browse files Browse the repository at this point in the history
Part 2 of #489.

Fixes #489
  • Loading branch information
tegefaulkes committed Oct 25, 2022
1 parent 5d92f6e commit 0421f73
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions src/nodes/NodeConnectionManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -799,14 +799,20 @@ class NodeConnectionManager {
@context ctx: ContextTimed,
): Promise<boolean> {
host = await networkUtils.resolveHost(host);
// FIXME: this needs to handle aborting
void Array.from(this.getSeedNodes(), (seedNodeId) => {
return this.sendSignallingMessage(
seedNodeId,
this.keyManager.getNodeId(),
nodeId,
);
const seedNodes = this.getSeedNodes();
const isSeedNode = !!seedNodes.find((nodeId) => {
return nodeId.equals(nodeId);
});
if (!isSeedNode) {
void Array.from(this.getSeedNodes(), (seedNodeId) => {
// FIXME: this needs to handle aborting
return this.sendSignallingMessage(
seedNodeId,
this.keyManager.getNodeId(),
nodeId,
);
});
}
try {
await this.holePunchForward(nodeId, host, port, ctx);
} catch (e) {
Expand Down

0 comments on commit 0421f73

Please sign in to comment.