11#![ allow( missing_docs) ] // we need to allow missing docs for the derive macro
22//! Relay server behaviour.
33
4- use std:: time:: Duration ;
5-
64use libp2p:: { identify, identity:: Keypair , ping, relay, swarm:: NetworkBehaviour } ;
75
86use charon_p2p:: gater:: ConnGater ;
@@ -36,8 +34,6 @@ impl RelayServerBehaviour {
3634pub struct RelayServerBehaviourBuilder {
3735 gater : Option < ConnGater > ,
3836 identify_protocol : String ,
39- ping_interval : Duration ,
40- ping_timeout : Duration ,
4137 relay_config : Option < relay:: Config > ,
4238}
4339
@@ -46,8 +42,6 @@ impl Default for RelayServerBehaviourBuilder {
4642 Self {
4743 gater : None ,
4844 identify_protocol : "/pluto/relay/1.0.0-alpha" . into ( ) ,
49- ping_interval : Duration :: from_secs ( 1 ) ,
50- ping_timeout : Duration :: from_secs ( 2 ) ,
5145 relay_config : None ,
5246 }
5347 }
@@ -71,18 +65,6 @@ impl RelayServerBehaviourBuilder {
7165 self
7266 }
7367
74- /// Sets the ping interval.
75- pub fn with_ping_interval ( mut self , interval : Duration ) -> Self {
76- self . ping_interval = interval;
77- self
78- }
79-
80- /// Sets the ping timeout.
81- pub fn with_ping_timeout ( mut self , timeout : Duration ) -> Self {
82- self . ping_timeout = timeout;
83- self
84- }
85-
8668 /// Sets the relay server configuration.
8769 pub fn with_relay_config ( mut self , config : relay:: Config ) -> Self {
8870 self . relay_config = Some ( config) ;
@@ -100,11 +82,7 @@ impl RelayServerBehaviourBuilder {
10082 self . identify_protocol ,
10183 key. public ( ) ,
10284 ) ) ,
103- ping : ping:: Behaviour :: new (
104- ping:: Config :: new ( )
105- . with_interval ( self . ping_interval )
106- . with_timeout ( self . ping_timeout ) ,
107- ) ,
85+ ping : ping:: Behaviour :: new ( charon_p2p:: config:: default_ping_config ( ) ) ,
10886 gater : self
10987 . gater
11088 . unwrap_or_else ( || ConnGater :: new_conn_gater ( vec ! [ ] , vec ! [ ] ) ) ,
0 commit comments