Skip to content
This repository has been archived by the owner on Jun 26, 2023. It is now read-only.

fix: add maxOutboundStreams option to connection.newStream #415

Merged
merged 1 commit into from
Jun 14, 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
11 changes: 10 additions & 1 deletion packages/interface-connection/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,15 @@ export interface Stream extends Duplex<AsyncGenerator<Uint8ArrayList>, Source<Ui
metadata: Record<string, any>
}

export interface NewStreamOptions extends AbortOptions {
/**
* If specified, and no handler has been registered with the registrar for the
* successfully negotiated protocol, use this as the max outbound stream limit
* for the protocol
*/
maxOutboundStreams?: number
}

/**
* A Connection is a high-level representation of a connection
* to a remote peer that may have been secured by encryption and
Expand All @@ -172,7 +181,7 @@ export interface Connection {
tags: string[]
streams: Stream[]

newStream: (multicodecs: string | string[], options?: AbortOptions) => Promise<Stream>
newStream: (multicodecs: string | string[], options?: NewStreamOptions) => Promise<Stream>
addStream: (stream: Stream) => void
removeStream: (id: string) => void
close: () => Promise<void>
Expand Down