Fix packet count when talking with PAR2 peers (#8555)
* Support diferent packet counts in different protocol versions. * Fix light timeouts and eclipse protection. * Fix devp2p tests. * Fix whisper-cli compilation. * Fix compilation. * Fix ethcore-sync tests. * Revert "Fix light timeouts and eclipse protection." This reverts commit 06285ea8c1d9d184d809f64b5507aece633da6cc. * Increase timeouts.
This commit is contained in:
committed by
Afri Schoedon
parent
981554cf74
commit
08abf67a51
@@ -218,10 +218,10 @@ fn execute<S, I>(command: I) -> Result<(), Error> where I: IntoIterator<Item=S>,
|
||||
network.start()?;
|
||||
|
||||
// Attach whisper protocol to the network service
|
||||
network.register_protocol(whisper_network_handler.clone(), whisper::net::PROTOCOL_ID, whisper::net::PACKET_COUNT,
|
||||
network.register_protocol(whisper_network_handler.clone(), whisper::net::PROTOCOL_ID,
|
||||
whisper::net::SUPPORTED_VERSIONS)?;
|
||||
network.register_protocol(Arc::new(whisper::net::ParityExtensions), whisper::net::PARITY_PROTOCOL_ID,
|
||||
whisper::net::PACKET_COUNT, whisper::net::SUPPORTED_VERSIONS)?;
|
||||
whisper::net::SUPPORTED_VERSIONS)?;
|
||||
|
||||
// Request handler
|
||||
let mut io = MetaIoHandler::default();
|
||||
|
||||
@@ -41,15 +41,17 @@ const RALLY_TIMEOUT: Duration = Duration::from_millis(2500);
|
||||
/// Current protocol version.
|
||||
pub const PROTOCOL_VERSION: usize = 6;
|
||||
|
||||
/// Number of packets. A bunch are reserved.
|
||||
const PACKET_COUNT: u8 = 128;
|
||||
|
||||
/// Supported protocol versions.
|
||||
pub const SUPPORTED_VERSIONS: &'static [u8] = &[PROTOCOL_VERSION as u8];
|
||||
pub const SUPPORTED_VERSIONS: &'static [(u8, u8)] = &[
|
||||
(PROTOCOL_VERSION as u8, PACKET_COUNT)
|
||||
];
|
||||
|
||||
// maximum tolerated delay between messages packets.
|
||||
const MAX_TOLERATED_DELAY: Duration = Duration::from_millis(5000);
|
||||
|
||||
/// Number of packets. A bunch are reserved.
|
||||
pub const PACKET_COUNT: u8 = 128;
|
||||
|
||||
/// Whisper protocol ID
|
||||
pub const PROTOCOL_ID: ::network::ProtocolId = *b"shh";
|
||||
|
||||
|
||||
Reference in New Issue
Block a user