deps: update tcp (#1366)

This commit is contained in:
Alex Potsides 2022-09-05 12:21:31 +02:00 committed by GitHub
parent 0e7096d527
commit fc2224a1e8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 22 additions and 6 deletions

View File

@ -40,7 +40,7 @@ const createNode = async () => {
])
// Wait for onConnect handlers in the DHT
await delay(100)
await delay(1000)
const cid = CID.parse('QmTp9VkYvnHyrqKQuFPiuZkiX9gPcqj6x5LJ1rmWuSySnL')
await node1.contentRouting.provide(cid)

View File

@ -182,7 +182,7 @@
"@libp2p/mdns": "^3.0.0",
"@libp2p/mplex": "^5.0.0",
"@libp2p/pubsub": "^3.0.1",
"@libp2p/tcp": "^3.0.0",
"@libp2p/tcp": "^3.0.5",
"@libp2p/topology": "^3.0.0",
"@libp2p/webrtc-star": "^3.0.0",
"@libp2p/websockets": "^3.0.0",

View File

@ -260,6 +260,12 @@ export class AutoRelay {
}
const peerId = provider.id
if (peerId.equals(this.components.getPeerId())) {
// Skip the provider if it's us as dialing will fail
continue
}
await this.components.getPeerStore().addressBook.add(peerId, provider.multiaddrs)
await this._tryToListenOnRelay(peerId)

View File

@ -284,7 +284,10 @@ export class Dialer implements Startable, Initializable {
throw errCode(new Error('already aborted'), codes.ERR_ALREADY_ABORTED)
}
return await this.components.getTransportManager().dial(addr, options)
return await this.components.getTransportManager().dial(addr, options).catch(err => {
log.error('dial to %s failed', addr, err)
throw err
})
}
const dialRequest = new DialRequest({

View File

@ -205,8 +205,10 @@ describe('auto-relay', () => {
})).to.eventually.be.rejected()
// Disconnect from peer used for relay
const disconnectPromise = pEvent(relayLibp2p1.connectionManager, 'peer:disconnect', { timeout: 500 })
await relayLibp2p2.stop()
await pEvent(relayLibp2p1.connectionManager, 'peer:disconnect', { timeout: 500 })
const event = await disconnectPromise
expect(event.detail.remotePeer.toString()).to.equal(relayLibp2p2.peerId.toString())
// Should not be using the relay any more
await expect(usingAsRelay(relayLibp2p1, relayLibp2p2, {
@ -399,6 +401,7 @@ describe('auto-relay', () => {
nock('http://0.0.0.0:60197')
.post('/api/v0/dht/findprovs')
.query(true)
.twice()
.reply(200, `{"Extra":"","ID":"${provider}","Responses":[{"Addrs":${JSON.stringify(multiaddrs)},"ID":"${provider}"}],"Type":4}\n`, [
'Content-Type', 'application/json',
'X-Chunked-Output', '1'
@ -432,10 +435,14 @@ describe('auto-relay', () => {
await local.hangUp(relayAddr)
// Should try to find relay service providers
await pWaitFor(() => contentRoutingFindProvidersSpy.callCount === 1)
await pWaitFor(() => contentRoutingFindProvidersSpy.callCount === 1, {
timeout: 1000
})
// Wait for peer added as listen relay
await pWaitFor(() => local.getMultiaddrs().length === originalMultiaddrsLength + 1)
await pWaitFor(() => local.getMultiaddrs().length === originalMultiaddrsLength + 1, {
timeout: 1000
})
const relayedAddr = local.getMultiaddrs()[local.getMultiaddrs().length - 1]
await remote.peerStore.addressBook.set(local.peerId, [relayedAddr])