From ea4306884829444a36dcf2ce238ce04c2299b3aa Mon Sep 17 00:00:00 2001 From: Arseniy Klempner Date: Fri, 26 Apr 2024 17:19:22 -0700 Subject: [PATCH] feat: add libp2p option for max ping connections --- packages/interfaces/src/libp2p.ts | 1 + packages/sdk/src/utils/libp2p.ts | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/interfaces/src/libp2p.ts b/packages/interfaces/src/libp2p.ts index 522b96cf5e..51905fa7a4 100644 --- a/packages/interfaces/src/libp2p.ts +++ b/packages/interfaces/src/libp2p.ts @@ -29,4 +29,5 @@ export type CreateLibp2pOptions = Libp2pOptions & { * @default false */ hideWebSocketInfo?: boolean; + pingMaxInboundStreams?: number; }; diff --git a/packages/sdk/src/utils/libp2p.ts b/packages/sdk/src/utils/libp2p.ts index 4cc31f702d..68414eb47e 100644 --- a/packages/sdk/src/utils/libp2p.ts +++ b/packages/sdk/src/utils/libp2p.ts @@ -70,7 +70,9 @@ export async function defaultLibp2p( identify: identify({ agentVersion: userAgent ?? DefaultUserAgent }), - ping: ping(), + ping: ping({ + maxInboundStreams: options?.pingMaxInboundStreams ?? 10 + }), ...metadataService, ...pubsubService, ...options?.services