@@ -90,7 +90,7 @@ const echoService = (components: EchoServiceComponents): unknown => {
90
90
stream , stream
91
91
)
92
92
} , {
93
- runOnTransientConnection : true
93
+ runOnLimitedConnection : true
94
94
} )
95
95
} ,
96
96
stop ( ) { }
@@ -560,7 +560,7 @@ describe('circuit-relay', () => {
560
560
561
561
// open hop stream and try to connect to remote
562
562
const stream = await local.dialProtocol(ma, RELAY_V2_HOP_CODEC, {
563
- runOnTransientConnection : true
563
+ runOnLimitedConnection : true
564
564
})
565
565
566
566
const hopStream = pbStream(stream).pb(HopMessage)
@@ -638,43 +638,43 @@ describe('circuit-relay', () => {
638
638
expect ( circuitListener [ 0 ] . relayStore . listenerCount ( 'relay:removed' ) ) . to . equal ( 1 )
639
639
} )
640
640
641
- it ( 'should mark an outgoing relayed connection as transient ' , async ( ) => {
641
+ it ( 'should mark an outgoing relayed connection as limited ' , async ( ) => {
642
642
// discover relay and make reservation
643
643
const connectionToRelay = await remote . dial ( relay1 . getMultiaddrs ( ) [ 0 ] )
644
644
645
- // connection to relay should not be marked transient
646
- expect ( connectionToRelay ) . to . have . property ( 'transient' , false )
645
+ // connection to relay should not be limited
646
+ expect ( connectionToRelay ) . to . have . property ( 'limits' ) . that . is . undefined ( )
647
647
648
648
await usingAsRelay ( remote , relay1 )
649
649
650
650
// dial the remote through the relay
651
651
const ma = getRelayAddress ( remote )
652
652
const connection = await local . dial ( ma )
653
653
654
- // connection to remote through relay should be marked transient
655
- expect ( connection ) . to . have . property ( 'transient' , true )
654
+ // connection to remote through relay should be limited
655
+ expect ( connection ) . to . have . property ( 'limits' ) . that . is . ok ( )
656
656
} )
657
657
658
- it ( 'should mark an incoming relayed connection as transient ' , async ( ) => {
658
+ it ( 'should mark an incoming relayed connection as limited ' , async ( ) => {
659
659
// discover relay and make reservation
660
660
const connectionToRelay = await remote . dial ( relay1 . getMultiaddrs ( ) [ 0 ] )
661
661
662
- // connection to relay should not be marked transient
663
- expect ( connectionToRelay ) . to . have . property ( 'transient' , false )
662
+ // connection to relay should not be limited
663
+ expect ( connectionToRelay ) . to . have . property ( 'limits' ) . that . is . undefined ( )
664
664
665
665
await usingAsRelay ( remote , relay1 )
666
666
667
667
// dial the remote through the relay
668
668
const ma = getRelayAddress ( remote )
669
669
await local . dial ( ma )
670
670
671
- // connection from local through relay should be marked transient
671
+ // connection from local through relay should be limited
672
672
const connections = remote . getConnections ( local . peerId )
673
673
expect ( connections ) . to . have . lengthOf ( 1 )
674
- expect ( connections ) . to . have . nested . property ( '[0].transient' , true )
674
+ expect ( connections ) . to . have . nested . property ( '[0].limits' ) . that . is . ok ( )
675
675
} )
676
676
677
- it ( 'should not open streams on a transient connection' , async ( ) => {
677
+ it ( 'should not open streams on a limited connection' , async ( ) => {
678
678
// discover relay and make reservation
679
679
await remote . dial ( relay1 . getMultiaddrs ( ) [ 0 ] )
680
680
await usingAsRelay ( remote , relay1 )
@@ -683,21 +683,21 @@ describe('circuit-relay', () => {
683
683
const ma = getRelayAddress ( remote )
684
684
const connection = await local . dial ( ma )
685
685
686
- // connection should be marked transient
687
- expect ( connection ) . to . have . property ( 'transient' , true )
686
+ // connection should be marked limited
687
+ expect ( connection ) . to . have . property ( 'limits' ) . that . is . ok ( )
688
688
689
689
await expect ( connection . newStream ( '/my-protocol/1.0.0' ) )
690
- . to . eventually . be . rejected . with . property ( 'code' , 'ERR_TRANSIENT_CONNECTION ' )
690
+ . to . eventually . be . rejected . with . property ( 'code' , 'ERR_LIMITED_CONNECTION ' )
691
691
} )
692
692
693
- it ( 'should not allow incoming streams on a transient connection' , async ( ) => {
693
+ it ( 'should not allow incoming streams on a limited connection' , async ( ) => {
694
694
const protocol = '/my-protocol/1.0.0'
695
695
696
- // remote registers handler, disallow running over transient streams
696
+ // remote registers handler, disallow running over limited connections
697
697
await remote . handle ( protocol , ( { stream } ) => {
698
698
void pipe ( stream , stream )
699
699
} , {
700
- runOnTransientConnection : false
700
+ runOnLimitedConnection : false
701
701
} )
702
702
703
703
// discover relay and make reservation
@@ -708,23 +708,23 @@ describe('circuit-relay', () => {
708
708
const ma = getRelayAddress ( remote )
709
709
const connection = await local . dial ( ma )
710
710
711
- // connection should be marked transient
712
- expect ( connection ) . to . have . property ( 'transient' , true )
711
+ // connection should be marked limited
712
+ expect ( connection ) . to . have . property ( 'limits' ) . that . is . ok ( )
713
713
714
714
await expect ( connection . newStream ( '/my-protocol/1.0.0' , {
715
- runOnTransientConnection : false
715
+ runOnLimitedConnection : false
716
716
} ) )
717
- . to . eventually . be . rejected . with . property ( 'code' , 'ERR_TRANSIENT_CONNECTION ' )
717
+ . to . eventually . be . rejected . with . property ( 'code' , 'ERR_LIMITED_CONNECTION ' )
718
718
} )
719
719
720
- it ( 'should open streams on a transient connection when told to do so' , async ( ) => {
720
+ it ( 'should open streams on a limited connection when told to do so' , async ( ) => {
721
721
const protocol = '/my-protocol/1.0.0'
722
722
723
- // remote registers handler, allow running over transient streams
723
+ // remote registers handler, allow running over limited streams
724
724
await remote . handle ( protocol , ( { stream } ) => {
725
725
void pipe ( stream , stream )
726
726
} , {
727
- runOnTransientConnection : true
727
+ runOnLimitedConnection : true
728
728
} )
729
729
730
730
// discover relay and make reservation
@@ -735,11 +735,11 @@ describe('circuit-relay', () => {
735
735
const ma = getRelayAddress ( remote )
736
736
const connection = await local . dial ( ma )
737
737
738
- // connection should be marked transient
739
- expect ( connection ) . to . have . property ( 'transient' , true )
738
+ // connection should be marked limited
739
+ expect ( connection ) . to . have . property ( 'limits' ) . that . is . ok ( )
740
740
741
741
await expect ( connection . newStream ( '/my-protocol/1.0.0' , {
742
- runOnTransientConnection : true
742
+ runOnLimitedConnection : true
743
743
} ) )
744
744
. to . eventually . be . ok ( )
745
745
} )
@@ -912,15 +912,15 @@ describe('circuit-relay', () => {
912
912
} catch { }
913
913
} )
914
914
} , {
915
- runOnTransientConnection : true
915
+ runOnLimitedConnection : true
916
916
} )
917
917
918
918
// dial the remote from the local through the relay
919
919
const ma = getRelayAddress ( remote )
920
920
921
921
try {
922
922
const stream = await local . dialProtocol ( ma , protocol , {
923
- runOnTransientConnection : true
923
+ runOnLimitedConnection : true
924
924
} )
925
925
926
926
await stream . sink ( async function * ( ) {
@@ -1056,7 +1056,7 @@ describe('circuit-relay', () => {
1056
1056
const ma = getRelayAddress ( remote )
1057
1057
1058
1058
const stream = await local . dialProtocol ( ma , ECHO_PROTOCOL , {
1059
- runOnTransientConnection : true
1059
+ runOnLimitedConnection : true
1060
1060
} )
1061
1061
1062
1062
// write more than the default data limit
@@ -1075,7 +1075,7 @@ describe('circuit-relay', () => {
1075
1075
const ma = getRelayAddress ( remote )
1076
1076
1077
1077
const stream = await local . dialProtocol ( ma , ECHO_PROTOCOL , {
1078
- runOnTransientConnection : true
1078
+ runOnLimitedConnection : true
1079
1079
} )
1080
1080
1081
1081
let finished = false
@@ -1107,21 +1107,21 @@ describe('circuit-relay', () => {
1107
1107
expect ( finish - start ) . to . be . greaterThan ( defaultDurationLimit )
1108
1108
} )
1109
1109
1110
- it ( 'should not mark an outgoing connection as transient ' , async ( ) => {
1110
+ it ( 'should not mark an outgoing connection as limited ' , async ( ) => {
1111
1111
const ma = getRelayAddress ( remote )
1112
1112
1113
1113
const connection = await local . dial ( ma )
1114
- expect ( connection ) . to . have . property ( 'transient' , false )
1114
+ expect ( connection ) . to . have . property ( 'limits' ) . that . is . undefined ( )
1115
1115
} )
1116
1116
1117
- it ( 'should not mark an incoming connection as transient ' , async ( ) => {
1117
+ it ( 'should not mark an incoming connection as limited ' , async ( ) => {
1118
1118
const ma = getRelayAddress ( remote )
1119
1119
1120
1120
await local . dial ( ma )
1121
1121
1122
1122
const connections = remote . getConnections ( local . peerId )
1123
1123
expect ( connections ) . to . have . lengthOf ( 1 )
1124
- expect ( connections ) . to . have . nested . property ( '[0].transient' , false )
1124
+ expect ( connections ) . to . have . nested . property ( '[0].limits' ) . that . is . undefined ( )
1125
1125
} )
1126
1126
} )
1127
1127
} )
0 commit comments