This repository has been archived by the owner on Apr 24, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 19
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
vasco-santos
force-pushed
the
refactor/async-iterators
branch
2 times, most recently
from
August 21, 2019 15:55
2bf44b5
to
adfbd40
Compare
vasco-santos
force-pushed
the
refactor/async-iterators
branch
4 times, most recently
from
September 29, 2019 18:51
b667ff3
to
6db3985
Compare
There is a bug for: |
vasco-santos
force-pushed
the
refactor/async-iterators
branch
from
September 29, 2019 19:06
6db3985
to
b526143
Compare
BREAKING CHANGE: Switch to using async/await and async iterators. The transport and connection interfaces have changed.
vasco-santos
force-pushed
the
refactor/async-iterators
branch
from
September 29, 2019 19:09
b526143
to
310730b
Compare
jacobheun
suggested changes
Sep 30, 2019
vasco-santos
force-pushed
the
refactor/async-iterators
branch
2 times, most recently
from
September 30, 2019 17:04
3d1d689
to
f8ad945
Compare
jacobheun
reviewed
Sep 30, 2019
1 task
vasco-santos
force-pushed
the
refactor/async-iterators
branch
3 times, most recently
from
September 30, 2019 17:54
2443f4d
to
36630d7
Compare
Co-Authored-By: Jacob Heun <jacobheun@gmail.com>
vasco-santos
force-pushed
the
refactor/async-iterators
branch
from
September 30, 2019 17:58
36630d7
to
bb7f7fc
Compare
jacobheun
approved these changes
Oct 2, 2019
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
Merged
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
BREAKING CHANGE: Switch to using async/await and async iterators. The transport and connection interfaces have changed.
In the context of ipfs/js-ipfs#1670
Interface Transport
dial(ma<Multiaddr>, [options<Object>]): Promise<Connection>
Dial to a peer at the given multiaddr, returns a promise that is resolved when the connection has opened. Throws if connection error or any other error opening the connection, including if the connection is aborted.
The promise resolves to a
Connection
(which is a duplex object) that can be used to communicate with the peer.Options
signal
- anAbortSignal
that can be used to abort the dial. You can obtain one from anAbortController
createListener([options<Object>], [handler<Function<Connection>>]): Listener
Create a new listener, where incoming connections are handled by
handler
. The handler function is called for each new incoming connection. It is passed aConnection
(which is a duplex object). Note the handler param is optional and can be registered later by listening for the 'connected' event.filter(mas<Multiaddr[]>): Multiaddr[]
Filter the multiaddrs this transport can dial.
Events
listening
After the listener has started listening.
connected
For every new connection. The event handler is passed a
Connection
(which is a duplex object).close
After the listener has stopped listening.
Interface Listener
listen(): Promise
getAddrs(): Promise<Multiaddr[]>
Interface Connection
sink<Function>
https://gist.github.com/alanshaw/591dc7dd54e4f99338a347ef568d6ee9#sink-it
source<Iterable>
https://gist.github.com/alanshaw/591dc7dd54e4f99338a347ef568d6ee9#source-it
getObservedAddrs(): Promise<Multiaddr[]>
close(): Promise