Skip to content
This repository has been archived by the owner on Nov 6, 2020. It is now read-only.

Commit

Permalink
fix(nits)
Browse files Browse the repository at this point in the history
  • Loading branch information
niklasad1 committed Oct 16, 2018
1 parent 3e50f39 commit 56779ff
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 9 deletions.
2 changes: 1 addition & 1 deletion ethcore/light/src/net/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ pub trait Handler: Send + Sync {
fn tick(&self, _ctx: &BasicContext) { }
/// Called on abort. This signals to handlers that they should clean up
/// and ignore peers.
// TODO: coreresponding `on_activate`?
// TODO: corresponding `on_activate`?
fn on_abort(&self) { }
}

Expand Down
8 changes: 3 additions & 5 deletions ethcore/light/src/on_demand/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ pub mod error {
display("On-demand query limit reached on query #{}", query_index)
}

#[doc = "No reply with current peer set, time out occured while waiting for new peers for additional query attempt."]
#[doc = "No reply with current peer set, time out occurred while waiting for new peers for additional query attempt."]
TimeoutOnNewPeers(query_index: usize, remaining_attempts: usize) {
description("Timeout for On-demand query")
display("Timeout for On-demand query; {} query attempts remain for query #{}", remaining_attempts, query_index)
Expand Down Expand Up @@ -187,8 +187,6 @@ impl Pending {
// supply a response.
fn supply_response(&mut self, cache: &Mutex<Cache>, response: &basic_request::Response)
-> Result<(), basic_request::ResponseError<self::request::Error>> {

println!("{:?}", response);
match self.requests.supply_response(&cache, response) {
Ok(response) => {
let idx = self.responses.len();
Expand Down Expand Up @@ -271,7 +269,7 @@ impl Pending {
// The given request is determined as faulty and drop it accordingly
fn set_as_faulty_request(self, total_peers: usize, req_id: ReqId) {
let bad_peers = self.bad_responses.len();
warn!(target: "on_demand", "The request: {} was determined as faulty, {}/{} peer(s) gave bad response", req_id, bad_peers, total_peers);
trace!(target: "on_demand", "The request: {} was determined as faulty, {}/{} peer(s) gave bad response", req_id, bad_peers, total_peers);
let err = self::error::ErrorKind::FaultyRequest(req_id, bad_peers, total_peers);
if self.sender.send(Err(err.into())).is_err() {
debug!(target: "on_demand", "Dropped oneshot channel receiver on time out");
Expand Down Expand Up @@ -649,7 +647,7 @@ impl Handler for OnDemand {
return;
}

// no remaning queries attempts left on the response
// no remaining queries attempts left on the response
if pending.remaining_query_count == 0 {
pending.no_response();
return;
Expand Down
6 changes: 3 additions & 3 deletions ethcore/light/src/on_demand/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -374,11 +374,11 @@ fn part_bad_part_good() {
}

#[test]
fn determine_faulty_response_by_majority() {
fn determine_response_as_faulty_by_majority() {
let mut harness = Harness::create();

// peer[0] - requester ("light")
// peer[1..9] - responders ("providers"
// peer[1..9] - responders ("providers")
let peers: Vec<PeerId> = (1..=10).map(|id| id).collect();

let req_id = ReqId(14426);
Expand Down Expand Up @@ -425,7 +425,7 @@ fn determine_faulty_response_by_majority() {
}

#[test]
fn faulty_by_response_minority_many_times() {
fn response_by_minority_many_times() {
let mut harness = Harness::create();

let peers: Vec<PeerId> = (1..=10).map(|id| id).collect();
Expand Down

0 comments on commit 56779ff

Please sign in to comment.