ProtocolViolation,
Timeout,
TimeoutDuringRequest,
+ TimeoutAwaitingPong,
TimeoutAwaitingAddr,
TimeoutAwaitingBlock,
Good,
0x6 => Some(AddressState::ProtocolViolation),
0x7 => Some(AddressState::Timeout),
0x8 => Some(AddressState::TimeoutDuringRequest),
- 0x9 => Some(AddressState::TimeoutAwaitingAddr),
- 0xa => Some(AddressState::TimeoutAwaitingBlock),
- 0xb => Some(AddressState::Good),
- 0xc => Some(AddressState::WasGood),
+ 0x9 => Some(AddressState::TimeoutAwaitingPong),
+ 0xa => Some(AddressState::TimeoutAwaitingAddr),
+ 0xb => Some(AddressState::TimeoutAwaitingBlock),
+ 0xc => Some(AddressState::Good),
+ 0xd => Some(AddressState::WasGood),
_ => None,
}
}
AddressState::ProtocolViolation => 6,
AddressState::Timeout => 7,
AddressState::TimeoutDuringRequest => 8,
- AddressState::TimeoutAwaitingAddr => 9,
- AddressState::TimeoutAwaitingBlock => 10,
- AddressState::Good => 11,
- AddressState::WasGood => 12,
+ AddressState::TimeoutAwaitingPong => 9,
+ AddressState::TimeoutAwaitingAddr => 10,
+ AddressState::TimeoutAwaitingBlock => 11,
+ AddressState::Good => 12,
+ AddressState::WasGood => 13,
}
}
AddressState::ProtocolViolation => "Protocol Violation",
AddressState::Timeout => "Timeout",
AddressState::TimeoutDuringRequest => "Timeout During Request",
+ AddressState::TimeoutAwaitingPong => "Timeout Awaiting Pong",
AddressState::TimeoutAwaitingAddr => "Timeout Awaiting Addr",
AddressState::TimeoutAwaitingBlock => "Timeout Awaiting Block",
AddressState::Good => "Good",
}
pub const fn get_count() -> u8 {
- 13
+ 14
}
}
u64s.insert(U64Setting::RescanInterval(AddressState::ProtocolViolation), try_read!(l, u64));
u64s.insert(U64Setting::RescanInterval(AddressState::Timeout), try_read!(l, u64));
u64s.insert(U64Setting::RescanInterval(AddressState::TimeoutDuringRequest), try_read!(l, u64));
+ u64s.insert(U64Setting::RescanInterval(AddressState::TimeoutAwaitingPong), try_read!(l, u64));
u64s.insert(U64Setting::RescanInterval(AddressState::TimeoutAwaitingAddr), try_read!(l, u64));
u64s.insert(U64Setting::RescanInterval(AddressState::TimeoutAwaitingBlock), try_read!(l, u64));
u64s.insert(U64Setting::RescanInterval(AddressState::Good), try_read!(l, u64));
u64s.insert(U64Setting::RescanInterval(AddressState::ProtocolViolation), 86400);
u64s.insert(U64Setting::RescanInterval(AddressState::Timeout), 86400);
u64s.insert(U64Setting::RescanInterval(AddressState::TimeoutDuringRequest), 21600);
+ u64s.insert(U64Setting::RescanInterval(AddressState::TimeoutAwaitingPong), 3600);
u64s.insert(U64Setting::RescanInterval(AddressState::TimeoutAwaitingAddr), 1800);
u64s.insert(U64Setting::RescanInterval(AddressState::TimeoutAwaitingBlock), 3600);
u64s.insert(U64Setting::RescanInterval(AddressState::Good), 1800);
pub fn save_data(&'static self) -> impl Future<Item=(), Error=()> {
let settings_file = self.store.clone() + "/settings";
let settings_future = File::create(settings_file.clone() + ".tmp").and_then(move |f| {
- let settings_string = format!("{}\n{}\n{}\n{}\n{}\n{}\n{}\n{}\n{}\n{}\n{}\n{}\n{}\n{}\n{}\n{}\n{}\n{}",
+ let settings_string = format!("{}\n{}\n{}\n{}\n{}\n{}\n{}\n{}\n{}\n{}\n{}\n{}\n{}\n{}\n{}\n{}\n{}\n{}\n{}",
self.get_u64(U64Setting::ConnsPerSec),
self.get_u64(U64Setting::RunTimeout),
self.get_u64(U64Setting::WasGoodTimeout),
self.get_u64(U64Setting::RescanInterval(AddressState::ProtocolViolation)),
self.get_u64(U64Setting::RescanInterval(AddressState::Timeout)),
self.get_u64(U64Setting::RescanInterval(AddressState::TimeoutDuringRequest)),
+ self.get_u64(U64Setting::RescanInterval(AddressState::TimeoutAwaitingPong)),
self.get_u64(U64Setting::RescanInterval(AddressState::TimeoutAwaitingAddr)),
self.get_u64(U64Setting::RescanInterval(AddressState::TimeoutAwaitingBlock)),
self.get_u64(U64Setting::RescanInterval(AddressState::Good)),
}
} else {
assert!(state_lock.fail_reason != AddressState::Good);
- if state_lock.fail_reason == AddressState::TimeoutDuringRequest && state_lock.recvd_version && state_lock.recvd_verack && state_lock.recvd_pong {
- if !state_lock.recvd_addrs {
+ if state_lock.fail_reason == AddressState::TimeoutDuringRequest && state_lock.recvd_version && state_lock.recvd_verack {
+ if !state_lock.recvd_pong {
+ state_lock.fail_reason = AddressState::TimeoutAwaitingPong;
+ } else if !state_lock.recvd_addrs {
state_lock.fail_reason = AddressState::TimeoutAwaitingAddr;
} else if !state_lock.recvd_block {
state_lock.fail_reason = AddressState::TimeoutAwaitingBlock;
}
let old_state = store.set_node_state(node, state_lock.fail_reason, 0);
if (manual || old_state != state_lock.fail_reason) && state_lock.fail_reason == AddressState::TimeoutDuringRequest {
- printer.add_line(format!("Updating {} from {} to Timeout During Request (ver: {}, vack: {}, pong: {})",
- node, old_state.to_str(), state_lock.recvd_version, state_lock.recvd_verack, state_lock.recvd_pong), true);
+ printer.add_line(format!("Updating {} from {} to Timeout During Request (ver: {}, vack: {})",
+ node, old_state.to_str(), state_lock.recvd_version, state_lock.recvd_verack), true);
} else if manual || (old_state != state_lock.fail_reason && state_lock.msg.0 != "" && state_lock.msg.1) {
printer.add_line(format!("Updating {} from {} to {} {}", node, old_state.to_str(), state_lock.fail_reason.to_str(), &state_lock.msg.0), state_lock.msg.1);
}