diff --git a/sdk/README.md b/sdk/README.md index f18855b1..b83d595e 100644 --- a/sdk/README.md +++ b/sdk/README.md @@ -92,14 +92,18 @@ pinned by a test: - js-libp2p reserves a relay slot when it starts listening on `/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. diff --git a/sdk/js/src/host.ts b/sdk/js/src/host.ts index c33cd357..32693947 100644 --- a/sdk/js/src/host.ts +++ b/sdk/js/src/host.ts @@ -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 { const internals = node as unknown as { components: { transportManager: { listen(addrs: Multiaddr[]): Promise; getListeners(): RelayListener[] } } }; diff --git a/sdk/js/src/session.ts b/sdk/js/src/session.ts index 5274fbb1..cae0437e 100644 --- a/sdk/js/src/session.ts +++ b/sdk/js/src/session.ts @@ -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 { this.#keepingRelay ??= this.#keepRelayOnce().finally(() => {