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

Commit

Permalink
ethcore-light uses bincode 1.1 (#10798)
Browse files Browse the repository at this point in the history
  • Loading branch information
debris authored and ordian committed Jun 27, 2019
1 parent 62832c9 commit afe14b4
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 36 deletions.
68 changes: 37 additions & 31 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion ethcore/light/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ smallvec = "0.6"
futures = "0.1"
rand = "0.6"
itertools = "0.5"
bincode = "0.8.0"
bincode = "1.1"
serde = "1.0"
serde_derive = "1.0"
parking_lot = "0.7"
Expand Down
8 changes: 4 additions & 4 deletions ethcore/light/src/net/load_timer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -199,15 +199,15 @@ pub struct FileStore(pub PathBuf);
impl SampleStore for FileStore {
fn load(&self) -> HashMap<Kind, VecDeque<u64>> {
File::open(&self.0)
.map_err(|e| Box::new(bincode::ErrorKind::IoError(e)))
.and_then(|mut file| bincode::deserialize_from(&mut file, bincode::Infinite))
.map_err(|e| Box::new(bincode::ErrorKind::Io(e)))
.and_then(|mut file| bincode::deserialize_from(&mut file))
.unwrap_or_else(|_| HashMap::new())
}

fn store(&self, samples: &HashMap<Kind, VecDeque<u64>>) {
let res = File::create(&self.0)
.map_err(|e| Box::new(bincode::ErrorKind::IoError(e)))
.and_then(|mut file| bincode::serialize_into(&mut file, samples, bincode::Infinite));
.map_err(|e| Box::new(bincode::ErrorKind::Io(e)))
.and_then(|mut file| bincode::serialize_into(&mut file, samples));

if let Err(e) = res {
warn!(target: "pip", "Error writing light request timing samples to file: {}", e);
Expand Down

0 comments on commit afe14b4

Please sign in to comment.