mirror of
https://github.com/fluencelabs/js-libp2p
synced 2025-06-13 01:01:23 +00:00
fix: add timeout for incoming connections and build-in protocols (#1292)
Ensure that we don't wait forever for upgrading an inbound connection to occur. Note that transports should return an AbortableSource when passed an AbortSignal so outbound connections to not need the same fix. Also adds default timeouts for the ping, fetch, and identify protocols.
This commit is contained in:
@ -19,7 +19,8 @@ import { MemoryDatastore } from 'datastore-core'
|
||||
const defaultInit: FetchServiceInit = {
|
||||
protocolPrefix: 'ipfs',
|
||||
maxInboundStreams: 1,
|
||||
maxOutboundStreams: 1
|
||||
maxOutboundStreams: 1,
|
||||
timeout: 1000
|
||||
}
|
||||
|
||||
async function createComponents (index: number) {
|
||||
@ -34,7 +35,8 @@ async function createComponents (index: number) {
|
||||
connectionManager: new DefaultConnectionManager({
|
||||
minConnections: 50,
|
||||
maxConnections: 1000,
|
||||
autoDialInterval: 1000
|
||||
autoDialInterval: 1000,
|
||||
inboundUpgradeTimeout: 1000
|
||||
})
|
||||
})
|
||||
|
||||
|
Reference in New Issue
Block a user