Skip to content

Commit

Permalink
Alpha.7 update (#24)
Browse files Browse the repository at this point in the history
* Remove auth_tag mapping for responded requests

* Version bump
  • Loading branch information
AgeManning authored Jul 21, 2020
1 parent 89e3d89 commit 66faed4
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 12 deletions.
16 changes: 8 additions & 8 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
name = "discv5"
authors = ["Age Manning <[email protected]>"]
edition = "2018"
version = "0.1.0-alpha.6"
version = "0.1.0-alpha.7"
description = "Implementation of the p2p discv5 discovery protocol"
license = "MIT"
repository = "https://github.com/sigp/discv5"
Expand All @@ -15,34 +15,34 @@ exclude = [
]

[dependencies]
enr = { version = "0.1.0", features = ["libsecp256k1", "ed25519"] }
enr = { version = "0.1.1", features = ["libsecp256k1", "ed25519"] }
tokio = { version = "0.2.21", features = ["net", "stream", "time", "sync"] }
zeroize = { version = "1.1.0", features = ["zeroize_derive"] }
libp2p-core = { version = "0.20.0", optional = true }
libp2p-core = { version = "0.20.1", optional = true }
multihash = { version = "0.11.2", optional = true }
libsecp256k1 = "0.3.5"
futures = "0.3.5"
uint = { version = "0.8.3", default-features = false }
log = "0.4.8"
log = "0.4.11"
rlp = "0.4.5"
sha2 = "0.8.1"
hkdf = "0.8.0"
openssl = "0.10.29"
openssl = "0.10.30"
hex = "0.4.2"
fnv = "1.0.7"
arrayvec = "0.5.1"
digest = "0.8.1"
rand = "0.7.3"
net2 = "0.2.34"
smallvec = "1.4.0"
parking_lot = "0.10.2"
smallvec = "1.4.1"
parking_lot = "0.11.0"
lru_time_cache = "0.10.0"
lazy_static = "1.4.0"

[dev-dependencies]
quickcheck = "0.9.2"
env_logger = "0.7.1"
hex-literal = "0.2.1"
hex-literal = "0.3.0"
simple_logger = "1.6.0"
tokio = { version = "0.2.21", features = ["time", "rt-threaded", "macros"] }
rand_xorshift = "0.2.0"
Expand Down
4 changes: 2 additions & 2 deletions examples/find_nodes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@
use discv5::{enr, enr::CombinedKey, Discv5, Discv5ConfigBuilder};
use futures::prelude::*;
use hex_literal::*;
use std::{
net::{Ipv4Addr, SocketAddr},
time::Duration,
Expand Down Expand Up @@ -65,7 +64,8 @@ async fn main() {
};

// A fixed key for testing
let raw_key = hex!("b71c71a67e1177ad4e901695e1b4b9ee17ae16c6668d313eac2f96dbcda3f291");
let raw_key =
hex::decode("b71c71a67e1177ad4e901695e1b4b9ee17ae16c6668d313eac2f96dbcda3f291").unwrap();
let secret_key = secp256k1::SecretKey::parse_slice(&raw_key).unwrap();
let mut enr_key = CombinedKey::from(secret_key);

Expand Down
4 changes: 2 additions & 2 deletions src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ pub struct Discv5Config {
/// The session timeout for each node. Default: 1 day.
pub session_timeout: Duration,

/// The maximum number of established sessions to maintain. Default: 100.
/// The maximum number of established sessions to maintain. Default: 1000.
pub session_cache_capacity: usize,

/// Updates the local ENR IP and port based on PONG responses from peers. Default: true.
Expand Down Expand Up @@ -72,7 +72,7 @@ impl Default for Discv5Config {
query_timeout: Duration::from_secs(60),
request_retries: 1,
session_timeout: Duration::from_secs(86400),
session_cache_capacity: 100,
session_cache_capacity: 1000,
enr_update: true,
enr_peer_update_min: 10,
query_parallelism: 3,
Expand Down
6 changes: 6 additions & 0 deletions src/handler/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -899,6 +899,12 @@ impl Handler {

// Remove the expected response
self.remove_expected_response(node_address.socket_addr.clone());

let auth_tag = request_call
.packet
.auth_tag()
.expect("No challenge packet in response");
self.active_requests_auth.remove(auth_tag);
// The request matches report the response
self.outbound_channel
.send(HandlerResponse::Response(
Expand Down

0 comments on commit 66faed4

Please sign in to comment.