From 91536e821a4e8162ab8a28a887f637f1bfa1c34a Mon Sep 17 00:00:00 2001 From: saul Date: Tue, 17 Oct 2023 09:28:24 +1300 Subject: [PATCH 1/2] fix: unhandled error in heads exchange --- src/replicator/bootstrap/index.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/replicator/bootstrap/index.ts b/src/replicator/bootstrap/index.ts index b33f5a47..3d1bbf9c 100644 --- a/src/replicator/bootstrap/index.ts +++ b/src/replicator/bootstrap/index.ts @@ -116,14 +116,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. From f53286287d4725b06250028088ea7fa216e5e78b Mon Sep 17 00:00:00 2001 From: saul Date: Tue, 17 Oct 2023 09:40:05 +1300 Subject: [PATCH 2/2] fix: ignore errors on heads exchange failures --- src/replicator/bootstrap/index.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/replicator/bootstrap/index.ts b/src/replicator/bootstrap/index.ts index 3d1bbf9c..26c35366 100644 --- a/src/replicator/bootstrap/index.ts +++ b/src/replicator/bootstrap/index.ts @@ -102,7 +102,11 @@ export class BootstrapReplicator extends Playable { } private async handle ({ stream, connection }: { stream: Stream, connection: Connection }): Promise { - 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 {