File tree Expand file tree Collapse file tree 3 files changed +5
-15
lines changed Expand file tree Collapse file tree 3 files changed +5
-15
lines changed Original file line number Diff line number Diff line change @@ -23,7 +23,7 @@ impl PassiveCommand {
23
23
let dial_to = self . dial_to . to_owned ( ) ;
24
24
let addr: Multiaddr = format ! ( "/ip4/0.0.0.0/tcp/{}" , self . listen_port) . parse ( ) ?;
25
25
26
- let mut relay = PassiveRelay :: new ( & addr) . start ( ) . await ?;
26
+ let mut relay = PassiveRelay :: start ( & addr) . await ?;
27
27
if let Some ( dial_to_address) = dial_to {
28
28
relay. dial_peer ( dial_to_address. clone ( ) ) ?;
29
29
}
Original file line number Diff line number Diff line change @@ -11,19 +11,11 @@ pub struct PassiveRelay {
11
11
}
12
12
13
13
impl PassiveRelay {
14
- /// Create a passive relay
15
- /// TODO: should be replaced by Self::start(...)
16
- pub fn new ( addr : & Multiaddr ) -> Self {
17
- Self {
18
- peer : Peer :: new ( addr) ,
19
- }
20
- }
21
-
22
14
/// Start a passive relay
23
- pub async fn start ( self ) -> StdResult < Self > {
15
+ pub async fn start ( addr : & Multiaddr ) -> StdResult < Self > {
24
16
debug ! ( "PassiveRelay: starting..." ) ;
25
17
Ok ( Self {
26
- peer : self . peer . start ( ) . await ?,
18
+ peer : Peer :: new ( addr ) . start ( ) . await ?,
27
19
} )
28
20
}
29
21
Original file line number Diff line number Diff line change @@ -48,17 +48,15 @@ async fn should_receive_registrations_from_signers_when_subscribed_to_pubsub() {
48
48
let relay_peer_address = signer_relay. peer_address ( ) . unwrap ( ) ;
49
49
info ! ( "Test: relay_address is '{relay_address:?}'" ) ;
50
50
51
- let mut p2p_client1 = PassiveRelay :: new ( & addr)
52
- . start ( )
51
+ let mut p2p_client1 = PassiveRelay :: start ( & addr)
53
52
. await
54
53
. expect ( "P2P client start failed" ) ;
55
54
p2p_client1
56
55
. peer
57
56
. dial ( relay_peer_address. clone ( ) )
58
57
. expect ( "P2P client dial to the relay should not fail" ) ;
59
58
60
- let mut p2p_client2 = PassiveRelay :: new ( & addr)
61
- . start ( )
59
+ let mut p2p_client2 = PassiveRelay :: start ( & addr)
62
60
. await
63
61
. expect ( "P2P client start failed" ) ;
64
62
p2p_client2
You can’t perform that action at this time.
0 commit comments