Skip to content
Merged
Show file tree
Hide file tree
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
12 changes: 8 additions & 4 deletions sdk/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,14 +92,18 @@ pinned by a test:
- js-libp2p reserves a relay slot when it starts listening on
`<relay>/p2p-circuit`, and a router refuses that before the auth
handshake. The JS SDK starts the listener after the handshake, through the
transport manager, which is not on the public `Libp2p` interface.
transport manager, which is not on the public `Libp2p` interface
([libp2p/js-libp2p#3645](https://github.com/libp2p/js-libp2p/issues/3645)).
- go-libp2p's relay grants a reservation for one hour and drops it when
that passes, and with the connection it was made on; a member that still
advertises the relayed address is then unreachable (`NO_RESERVATION`).
js-libp2p's listener renews on its own, but only on a connection the
router still holds the admission of; the JS SDK runs the handshake again
on every new connection to a router and, when the relayed address is
gone, authenticates and reserves again within thirty seconds. The Python
router still holds the admission of, and does not reserve again on a
static relay after the connection dropped
([libp2p/js-libp2p#3601](https://github.com/libp2p/js-libp2p/issues/3601));
the JS SDK runs the handshake again on every new connection to a router
and, when the relayed address is gone, authenticates and reserves again
within thirty seconds. The Python
SDK renews two minutes before the expiry the router returned, and within
thirty seconds of the connection to that router going, running the auth
handshake again first.
Expand Down
2 changes: 2 additions & 0 deletions sdk/js/src/host.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,8 @@ export interface RelayListener {
* restarts or trims the connection drops it, and js-libp2p does not ask a
* configured relay again. Calling `listen` on the returned listener does,
* without registering a second listener.
*
* Upstream: libp2p/js-libp2p#3645 (listen after start), #3601 (re-reserve).
*/
export async function listenThroughRelay(node: Libp2p, relayAddr: Multiaddr): Promise<RelayListener> {
const internals = node as unknown as { components: { transportManager: { listen(addrs: Multiaddr[]): Promise<void>; getListeners(): RelayListener[] } } };
Expand Down
2 changes: 1 addition & 1 deletion sdk/js/src/session.ts
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ export class MeshSession {
* tried in order, each dialed and authenticated again first, since the
* router forgot the admission with the connection. Runs on
* relayCheckIntervalMs; exposed so a caller can force it. Concurrent
* calls share one attempt.
* calls share one attempt. Upstream: libp2p/js-libp2p#3601.
*/
keepRelay(): Promise<void> {
this.#keepingRelay ??= this.#keepRelayOnce().finally(() => {
Expand Down
Loading