sync fixes
This commit is contained in:
parent
543156f4dd
commit
bb6862658f
|
|
@ -152,6 +152,13 @@ async fn retry_dropped_outgoing(ip: String, port: u16) {
|
||||||
for attempt in 1..=3 {
|
for attempt in 1..=3 {
|
||||||
sleep(Duration::from_secs(30)).await;
|
sleep(Duration::from_secs(30)).await;
|
||||||
|
|
||||||
|
if Connection::get_stream_from_memory(&addr_string).await.is_some() {
|
||||||
|
info!(
|
||||||
|
"[reconnect] dropped peer {addr_string} is already connected; stopping reconnect attempts"
|
||||||
|
);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
let socket_addr = match addr_string.parse() {
|
let socket_addr = match addr_string.parse() {
|
||||||
Ok(addr) => addr,
|
Ok(addr) => addr,
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
|
|
@ -175,8 +182,17 @@ async fn retry_dropped_outgoing(ip: String, port: u16) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
|
let err_string = err.to_string();
|
||||||
|
if err_string.contains(
|
||||||
|
"The connection is already in the connection manager Please wait 10 minutes and try again",
|
||||||
|
) {
|
||||||
|
info!(
|
||||||
|
"[reconnect] dropped peer {addr_string} is already in the connection manager; stopping reconnect attempts"
|
||||||
|
);
|
||||||
|
return;
|
||||||
|
}
|
||||||
warn!(
|
warn!(
|
||||||
"[reconnect] failed to reconnect dropped peer {addr_string} on attempt {attempt}/3: {err}"
|
"[reconnect] failed to reconnect dropped peer {addr_string} on attempt {attempt}/3: {err_string}"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -430,19 +430,7 @@ impl NodeInfo {
|
||||||
}
|
}
|
||||||
|
|
||||||
if state_changed && !remote_ip.is_empty() {
|
if state_changed && !remote_ip.is_empty() {
|
||||||
let broadcast_map = map.clone();
|
Self::broadcast_address_state(map, &edit.address, &remote_ip, &connections_key).await;
|
||||||
let broadcast_address = edit.address.clone();
|
|
||||||
let broadcast_remote_ip = remote_ip.clone();
|
|
||||||
let broadcast_connections_key = connections_key.clone();
|
|
||||||
tokio::spawn(async move {
|
|
||||||
Self::broadcast_address_state(
|
|
||||||
broadcast_map,
|
|
||||||
&broadcast_address,
|
|
||||||
&broadcast_remote_ip,
|
|
||||||
&broadcast_connections_key,
|
|
||||||
)
|
|
||||||
.await;
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
RpcResponse::Binary(b"Success".to_vec())
|
RpcResponse::Binary(b"Success".to_vec())
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,6 @@ impl NodeInfo {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Self::persist_recovery_snapshot("mined increment").await;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub async fn decrement_mined(address: &str) {
|
pub async fn decrement_mined(address: &str) {
|
||||||
|
|
@ -33,7 +32,6 @@ impl NodeInfo {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Self::persist_recovery_snapshot("mined decrement").await;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub async fn get_mined_count(address: &str) -> u8 {
|
pub async fn get_mined_count(address: &str) -> u8 {
|
||||||
|
|
|
||||||
|
|
@ -138,6 +138,8 @@ pub async fn bootstrap_peer_discovery(mut params: BootstrapParams) -> Result<(),
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
sleep(Duration::from_secs(2)).await;
|
||||||
|
|
||||||
let connect = Connect {
|
let connect = Connect {
|
||||||
addr: socket_addr,
|
addr: socket_addr,
|
||||||
node_ip: addr_string.clone(),
|
node_ip: addr_string.clone(),
|
||||||
|
|
@ -417,7 +419,7 @@ pub async fn process_handshake_response(
|
||||||
let join_mode = if crate::records::memory::network_mapping::NodeInfo::self_add_allowed_at_height(
|
let join_mode = if crate::records::memory::network_mapping::NodeInfo::self_add_allowed_at_height(
|
||||||
remote_height,
|
remote_height,
|
||||||
) {
|
) {
|
||||||
"bootstrap_self_add"
|
"bootstrap_unsigned_request"
|
||||||
} else {
|
} else {
|
||||||
"sponsored_add"
|
"sponsored_add"
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue