Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: bootstrap replicator errors #104

Merged
merged 2 commits into from
Oct 16, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions src/replicator/bootstrap/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,11 @@ export class BootstrapReplicator extends Playable {
}

private async handle ({ stream, connection }: { stream: Stream, connection: Connection }): Promise<void> {
await this.exchange(stream, connection.remotePeer, this.options.reverseSync)
try {
await this.exchange(stream, connection.remotePeer, this.options.reverseSync)
} catch (error) {
// Ignore
}
}

private async bootstrap (): Promise<void> {
Expand All @@ -116,14 +120,14 @@ export class BootstrapReplicator extends Playable {
promises.push(Promise.resolve().then(async () => {
if (!await this.libp2p.peerStore.has(peer.id)) {
await this.libp2p.peerStore.save(peer.id, peer)

// We need to dial so that libp2p can update multiaddrs.
await this.libp2p.dial(peer.id)
}

// We need to dial so that libp2p can update multiaddrs.
await this.libp2p.dial(peer.id)

const stream = await this.libp2p.dialProtocol(peer.id, this.protocol)
await this.exchange(stream, peer.id)
}))
}).catch(() => {}))
}

// Don't really care if individual head syncs fail.
Expand Down
Loading