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

Commit

Permalink
Merge pull request #5419 from paritytech/on-demand-priority
Browse files Browse the repository at this point in the history
Improve on-demand dispatch and add support for batch requests
  • Loading branch information
rphmeier authored May 17, 2017
2 parents 7626ddc + c7cf43d commit 5d973f8
Show file tree
Hide file tree
Showing 20 changed files with 1,414 additions and 549 deletions.
4 changes: 2 additions & 2 deletions ethcore/light/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,13 @@ pub mod provider;

#[cfg(feature = "ipc")]
pub mod provider {
#![allow(dead_code, unused_assignments, unused_variables, missing_docs)] // codegen issues
#![allow(dead_code, unused_assignments, unused_variables, missing_docs)] // codegen issues
include!(concat!(env!("OUT_DIR"), "/provider.rs"));
}

#[cfg(feature = "ipc")]
pub mod remote {
pub use provider::LightProviderClient;
pub use provider::LightProviderClient;
}

mod types;
Expand Down
2 changes: 1 addition & 1 deletion ethcore/light/src/net/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ use network::{NetworkContext, PeerId, NodeId};

use super::{Announcement, LightProtocol, ReqId};
use super::error::Error;
use request::Requests;
use request::NetworkRequests as Requests;

/// An I/O context which allows sending and receiving packets as well as
/// disconnecting peers. This is used as a generalization of the portions
Expand Down
7 changes: 6 additions & 1 deletion ethcore/light/src/net/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ use std::sync::Arc;
use std::sync::atomic::{AtomicUsize, Ordering};

use provider::Provider;
use request::{Request, Requests, Response};
use request::{Request, NetworkRequests as Requests, Response};

use self::request_credits::{Credits, FlowParams};
use self::context::{Ctx, TickCtx};
Expand Down Expand Up @@ -108,9 +108,14 @@ mod timeout {
}

/// A request id.
#[cfg(not(test))]
#[derive(Debug, Clone, Copy, PartialEq, Eq, Ord, PartialOrd, Hash)]
pub struct ReqId(usize);

#[cfg(test)]
#[derive(Debug, Clone, Copy, PartialEq, Eq, Ord, PartialOrd, Hash)]
pub struct ReqId(pub usize);

impl fmt::Display for ReqId {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "Request #{}", self.0)
Expand Down
2 changes: 1 addition & 1 deletion ethcore/light/src/net/request_set.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ use std::collections::{BTreeMap, HashMap};
use std::iter::FromIterator;

use request::Request;
use request::Requests;
use request::NetworkRequests as Requests;
use net::{timeout, ReqId};
use util::U256;

Expand Down
4 changes: 2 additions & 2 deletions ethcore/light/src/net/tests/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,14 @@ use std::sync::Arc;

// helper for encoding a single request into a packet.
// panics on bad backreference.
fn encode_single(request: Request) -> Requests {
fn encode_single(request: Request) -> NetworkRequests {
let mut builder = RequestBuilder::default();
builder.push(request).unwrap();
builder.build()
}

// helper for making a packet out of `Requests`.
fn make_packet(req_id: usize, requests: &Requests) -> Vec<u8> {
fn make_packet(req_id: usize, requests: &NetworkRequests) -> Vec<u8> {
let mut stream = RlpStream::new_list(2);
stream.append(&req_id).append_list(&requests.requests());
stream.out()
Expand Down
Loading

0 comments on commit 5d973f8

Please sign in to comment.