File tree Expand file tree Collapse file tree 2 files changed +1
-36
lines changed Expand file tree Collapse file tree 2 files changed +1
-36
lines changed Original file line number Diff line number Diff line change @@ -334,8 +334,7 @@ export class DialQueue {
334334 return false
335335 } )
336336
337- // return existing, open connection to peer if equal or better limits
338- if ( existingConnection ?. status === 'open' && ( existingConnection ?. limits == null || conn ?. limits != null ) ) {
337+ if ( existingConnection ?. status === 'open' ) {
339338 this . log ( 'already connected to %a' , existingConnection . remoteAddr )
340339 options ?. onProgress ?.( new CustomProgressEvent ( 'dial-queue:already-connected' ) )
341340
Original file line number Diff line number Diff line change @@ -414,40 +414,6 @@ describe('dial queue', () => {
414414 await expect ( dialer . dial ( addr2 ) ) . to . eventually . equal ( existingConnection )
415415 } )
416416
417- it ( 'should return new connection when existing connection to same peer is worse' , async ( ) => {
418- const remotePeer = peerIdFromPrivateKey ( await generateKeyPair ( 'Ed25519' ) )
419- const ip = multiaddr ( '/ip4/123.123.123.123' )
420- const addr1 = ip . encapsulate ( '/tcp/123' )
421- const addr2 = ip . encapsulate ( '/tcp/321' )
422-
423- const existingConnection = stubInterface < Connection > ( {
424- limits : {
425- bytes : 100n
426- } ,
427- remotePeer,
428- remoteAddr : addr1 . encapsulate ( `/p2p/${ remotePeer } ` ) ,
429- status : 'open'
430- } )
431-
432- const newConnection = stubInterface < Connection > ( {
433- limits : undefined ,
434- remotePeer,
435- remoteAddr : addr2 . encapsulate ( `/p2p/${ remotePeer } ` ) ,
436- status : 'open'
437- } )
438-
439- const connections = new PeerMap < Connection [ ] > ( )
440- connections . set ( remotePeer , [ existingConnection ] )
441-
442- components . transportManager . dialTransportForMultiaddr . callsFake ( ma => {
443- return stubInterface < Transport > ( )
444- } )
445- components . transportManager . dial . callsFake ( async ( ma , opts = { } ) => newConnection )
446- dialer = new DialQueue ( components , { connections } )
447-
448- await expect ( dialer . dial ( addr2 ) ) . to . eventually . equal ( newConnection )
449- } )
450-
451417 it ( 'should respect user dial signal over default timeout if it is passed' , async ( ) => {
452418 const dialTimeout = 10
453419 const userTimeout = 500
You can’t perform that action at this time.
0 commit comments