Skip to content

Commit 76df41d

Browse files
committed
p2p: rename backend_timeouts to backend_config
1 parent 125b333 commit 76df41d

30 files changed

Lines changed: 63 additions & 63 deletions

dns-server/src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ async fn run(options: DnsServerRunOptions) -> anyhow::Result<Never> {
8585
sync_stalling_timeout: Default::default(),
8686
peer_manager_config: Default::default(),
8787
protocol_config: Default::default(),
88-
backend_timeouts: Default::default(),
88+
backend_config: Default::default(),
8989
custom_disconnection_reason_for_banning: Default::default(),
9090
});
9191

node-lib/src/config_files/p2p.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ impl From<P2pConfigFile> for P2pConfig {
186186

187187
min_peer_software_version,
188188
},
189-
backend_timeouts: BackendTimeoutsConfig {
189+
backend_config: BackendConfig {
190190
outbound_connection_timeout: outbound_connection_timeout
191191
.map(|t| Duration::from_secs(t.into()))
192192
.into(),

p2p/backend-test-suite/src/block_announcement.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ where
193193
sync_stalling_timeout: Default::default(),
194194
peer_manager_config: Default::default(),
195195
protocol_config: Default::default(),
196-
backend_timeouts: Default::default(),
196+
backend_config: Default::default(),
197197
custom_disconnection_reason_for_banning: Default::default(),
198198
});
199199
let shutdown = Arc::new(SeqCstAtomicBool::new(false));

p2p/src/config.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -121,8 +121,8 @@ pub struct P2pConfig {
121121
/// Various limits related to the protocol; these should only be overridden in tests.
122122
pub protocol_config: ProtocolConfig,
123123

124-
/// Various timeouts used by the backend.
125-
pub backend_timeouts: BackendTimeoutsConfig,
124+
/// Various settings specific to the backend.
125+
pub backend_config: BackendConfig,
126126

127127
/// If set, this text will be sent to banned peers as part of the DisconnectionReason.
128128
pub custom_disconnection_reason_for_banning: Option<String>,
@@ -134,13 +134,13 @@ impl P2pConfig {
134134
/// It is calculated as the max clock diff setting plus handshake timeout to allow for
135135
/// imprecisions caused by the network latency.
136136
pub fn effective_max_clock_diff(&self) -> Duration {
137-
*self.max_clock_diff + *self.backend_timeouts.peer_handshake_timeout
137+
*self.max_clock_diff + *self.backend_config.peer_handshake_timeout
138138
}
139139
}
140140

141-
/// Part of P2pConfig containing various timeouts used by the backend.
141+
/// Part of P2pConfig containing various settings specific to the backend.
142142
#[derive(Default, Debug, Clone)]
143-
pub struct BackendTimeoutsConfig {
143+
pub struct BackendConfig {
144144
/// The outbound connection timeout value.
145145
pub outbound_connection_timeout: OutboundConnectionTimeout,
146146

p2p/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -344,7 +344,7 @@ pub fn make_p2p<S: PeerDbStorage + 'static>(
344344
//
345345
// For more details, see `Peer::handshake` and `P2pConfig`.
346346
assert_eq!(
347-
*p2p_config.backend_timeouts.peer_handshake_timeout,
347+
*p2p_config.backend_config.peer_handshake_timeout,
348348
Duration::from_secs(10),
349349
"Handshake timeout changed"
350350
);

p2p/src/net/default_backend/backend.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -732,7 +732,7 @@ where
732732
local_services_override,
733733
} => {
734734
let connection_fut = timeout(
735-
*self.p2p_config.backend_timeouts.outbound_connection_timeout,
735+
*self.p2p_config.backend_config.outbound_connection_timeout,
736736
self.transport.connect(address.socket_addr()),
737737
);
738738

p2p/src/net/default_backend/peer/handshake_handler.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,7 @@ impl HandshakeHandler {
328328
socket_writer: &mut MessageWriter<S, Message>,
329329
) -> crate::Result<CommonProtocolVersion> {
330330
// handshake with remote peer and send peer's info to backend
331-
let handshake_timeout = *self.p2p_config.backend_timeouts.peer_handshake_timeout;
331+
let handshake_timeout = *self.p2p_config.backend_config.peer_handshake_timeout;
332332
let handshake_res = timeout(
333333
handshake_timeout,
334334
self.handshake_impl(peer_event_sender, socket_reader, socket_writer),

p2p/src/net/default_backend/peer/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -356,7 +356,7 @@ where
356356
match send_result {
357357
Ok(()) => {
358358
let disconnect_result = tokio::time::timeout(
359-
*p2p_config.backend_timeouts.disconnection_timeout,
359+
*p2p_config.backend_config.disconnection_timeout,
360360
async {
361361
match writer_event_receiver.recv().await {
362362
Some(WriterEvent::WriterClosed(result)) => {
@@ -483,7 +483,7 @@ async fn writer_loop<S: PeerStream>(
483483
}
484484

485485
tokio::time::timeout(
486-
*p2p_config.backend_timeouts.socket_write_timeout,
486+
*p2p_config.backend_config.socket_write_timeout,
487487
socket_writer.send(*message),
488488
)
489489
.await

p2p/src/peer_manager/tests/addr_list_response_caching.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ fn make_p2p_config() -> P2pConfig {
264264
user_agent: mintlayer_core_user_agent(),
265265
sync_stalling_timeout: Default::default(),
266266
peer_manager_config: Default::default(),
267-
backend_timeouts: Default::default(),
267+
backend_config: Default::default(),
268268
custom_disconnection_reason_for_banning: Default::default(),
269269
}
270270
}

p2p/src/peer_manager/tests/addresses.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -735,7 +735,7 @@ async fn dont_use_dns_seed_if_connections_exist(#[case] seed: Seed) {
735735
sync_stalling_timeout: Default::default(),
736736
peer_manager_config: Default::default(),
737737
protocol_config: Default::default(),
738-
backend_timeouts: Default::default(),
738+
backend_config: Default::default(),
739739
custom_disconnection_reason_for_banning: Default::default(),
740740
});
741741
let (cmd_sender, mut cmd_receiver) = tokio::sync::mpsc::unbounded_channel();

0 commit comments

Comments
 (0)