Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: updated connection manager and dialer with new interface methods #1586

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
14 changes: 14 additions & 0 deletions src/connection-manager/dialer/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,20 @@ export class DefaultDialer implements Startable, Dialer {
}
}

/**
* Get the current dial targets which are pending
*/
getPendingDialTargets (): Map<string, AbortController> {
return this.pendingDialTargets
}

/**
* Returns true if the peer id is in the pending dials
*/
hasPendingDial (peerId: PeerId | Multiaddr): boolean {
return this.pendingDials.has(peerId.toString())
maschad marked this conversation as resolved.
Show resolved Hide resolved
}

/**
* Creates a DialTarget. The DialTarget is used to create and track
* the DialRequest to a given peer.
Expand Down
4 changes: 4 additions & 0 deletions src/connection-manager/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -470,6 +470,10 @@ export class DefaultConnectionManager extends EventEmitter<ConnectionManagerEven
return conns
}

getConnectionsMap (): Map<string, Connection[]> {
return this.connections
}

async openConnection (peerIdOrMultiaddr: PeerId | Multiaddr, options: AbortOptions = {}): Promise<Connection> {
const { peerId, multiaddr } = getPeerAddress(peerIdOrMultiaddr)

Expand Down