helia-coord 1.2.8 → 1.2.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -296,7 +296,7 @@ class ThisNodeUseCases {
296
296
  continue
297
297
  }
298
298
 
299
- let connected = false
299
+ let connected = { success: false }
300
300
 
301
301
  // If peer advertises itself as a Circuit Relay, connect to the circuit
302
302
  // relay connection info
@@ -304,8 +304,9 @@ class ThisNodeUseCases {
304
304
  const multiaddr = `/ip4/${peerData.data.circuitRelayInfo.ip4}/tcp/${peerData.data.circuitRelayInfo.tcpPort}/p2p/${thisPeer}`
305
305
 
306
306
  connected = await this.adapters.ipfs.connectToPeer({ multiaddr })
307
+ console.log('circuit relay data connected: ', connected)
307
308
 
308
- if (connected) {
309
+ if (connected.success) {
309
310
  this.adapters.log.statusLog(2,
310
311
  `Successfully connected to Circuit Relay peer ${thisPeer} through direct connection: ${multiaddr}.`
311
312
  )
@@ -330,10 +331,11 @@ class ThisNodeUseCases {
330
331
 
331
332
  // Attempt to connect to the node through a circuit relay.
332
333
  connected = await this.adapters.ipfs.connectToPeer({ multiaddr })
334
+ console.log('direct connection connected: ', connected)
333
335
 
334
336
  // If the connection was successful, break out of the relay loop.
335
337
  // Otherwise try to connect through the next relay.
336
- if (connected) {
338
+ if (connected.success) {
337
339
  this.adapters.log.statusLog(2,
338
340
  `Successfully connected to peer ${thisPeer} through direct connection: ${multiaddr}.`
339
341
  )
@@ -348,7 +350,7 @@ class ThisNodeUseCases {
348
350
  }
349
351
  }
350
352
 
351
- if (connected) {
353
+ if (connected.success) {
352
354
  continue
353
355
  }
354
356
 
@@ -374,10 +376,11 @@ class ThisNodeUseCases {
374
376
 
375
377
  // Attempt to connect to the node through a circuit relay.
376
378
  connected = await this.adapters.ipfs.connectToPeer({ multiaddr })
379
+ console.log('v2 relay connected: ', connected)
377
380
 
378
381
  // If the connection was successful, break out of the relay loop.
379
382
  // Otherwise try to connect through the next relay.
380
- if (connected) {
383
+ if (connected.success) {
381
384
  this.adapters.log.statusLog(0,
382
385
  `Successfully connected to peer ${thisPeer} through v2 circuit relay ${thisRelay.multiaddr}.`
383
386
  )
@@ -393,7 +396,7 @@ class ThisNodeUseCases {
393
396
  }
394
397
  }
395
398
 
396
- if (connected) {
399
+ if (connected.success) {
397
400
  continue
398
401
  }
399
402
 
@@ -413,8 +416,9 @@ class ThisNodeUseCases {
413
416
 
414
417
  // Attempt to connect to the node through a circuit relay.
415
418
  connected = await this.adapters.ipfs.connectToPeer({ multiaddr })
419
+ console.log('v1 relay connected: ', connected)
416
420
 
417
- if (connected) {
421
+ if (connected.success) {
418
422
  this.adapters.log.statusLog(2,
419
423
  `Successfully connected to peer ${thisPeer} through v1 circuit relay ${thisV1Relay}.`
420
424
  )
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "helia-coord",
3
- "version": "1.2.8",
3
+ "version": "1.2.9",
4
4
  "description": "A JS library for helping IPFS peers coordinate, find a common interest, and stay connected around that interest.",
5
5
  "main": "./index.js",
6
6
  "type": "module",
@@ -293,7 +293,7 @@ describe('#thisNode-Use-Cases', () => {
293
293
  sandbox.stub(uut.adapters.ipfs, 'getPeers').resolves(mockData.swarmPeers)
294
294
  sandbox.stub(uut, 'isFreshPeer').returns(true)
295
295
  sandbox.stub(uut.adapters.ipfs, 'connectToPeer')
296
- .onCall(0).resolves(true)
296
+ .onCall(0).resolves({ success: true })
297
297
  sandbox.stub(uut.utils, 'filterMultiaddrs').returns([])
298
298
 
299
299
  // Connect to that peer.
@@ -319,7 +319,7 @@ describe('#thisNode-Use-Cases', () => {
319
319
  sandbox.stub(uut.adapters.ipfs, 'getPeers').resolves(mockData.swarmPeers)
320
320
  sandbox.stub(uut, 'isFreshPeer').returns(true)
321
321
  sandbox.stub(uut.adapters.ipfs, 'connectToPeer')
322
- .onCall(0).resolves(true)
322
+ .onCall(0).resolves({ success: true })
323
323
  sandbox.stub(uut.utils, 'filterMultiaddrs').returns(['/ip4/123.45.6.7/p2p/ipfs-id'])
324
324
 
325
325
  // Connect to that peer.