Skip to content

Commit

Permalink
Update stream limits and connection limits (#53)
Browse files Browse the repository at this point in the history
  • Loading branch information
p-shahi authored Apr 15, 2023
1 parent 950a3ed commit 9d8e341
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 23 deletions.
24 changes: 12 additions & 12 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

27 changes: 16 additions & 11 deletions packages/frontend/src/lib/libp2p.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,22 @@ import { BOOTSTRAP_NODE, CHAT_TOPIC, CIRCUIT_RELAY_CODE } from './constants'
import * as filters from "@libp2p/websockets/filters"

// @ts-ignore
import { circuitRelayTransport, circuitRelayServer } from 'libp2p/circuit-relay'
import { circuitRelayTransport } from 'libp2p/circuit-relay'


export async function startLibp2p() {
// localStorage.debug = 'libp2p*,-*:trace'
// application-specific data lives in the datastore

// libp2p is the networking layer that underpins Helia
const libp2p = await createLibp2p({
dht: kadDHT({protocolPrefix: "/universal-connectivity", maxInboundStreams: 100, maxOutboundStreams: 100, clientMode: true}),
// set the inbound and outbound stream limits to these values
// because we were seeing a lot of the default limits being hit
dht: kadDHT({
protocolPrefix: "/universal-connectivity",
maxInboundStreams: 5000,
maxOutboundStreams: 5000,
clientMode: true
}),
transports: [webTransport(), webSockets({
filter: filters.all,
}), webRTC({
Expand All @@ -44,10 +50,6 @@ export async function startLibp2p() {
discoverRelays: 10,
}),],
connectionEncryption: [noise()],
connectionManager: {
maxConnections: 200,
minConnections: 1,
},
streamMuxers: [yamux()],
peerDiscovery: [
bootstrap({
Expand All @@ -64,12 +66,15 @@ export async function startLibp2p() {
ignoreDuplicatePublishError: true,
}),
identify: {
maxPushOutgoingStreams: 100,
maxInboundStreams: 100,
maxOutboundStreams: 100,
// these are set because we were seeing a lot of identify and identify push
// stream limits being hit
maxPushOutgoingStreams: 1000,
maxPushIncomingStreams: 1000,
maxInboundStreams: 1000,
maxOutboundStreams: 1000,
},
autonat: {
startupDelay: 60 * 60 *24 * 1000,
startupDelay: 60 * 60 * 24 * 1000,
},
})

Expand Down

1 comment on commit 9d8e341

@vercel
Copy link

@vercel vercel bot commented on 9d8e341 Apr 15, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.