Downgrade bincode to 0.8.
This commit is contained in:
parent
839a54b01f
commit
07d4f544d7
|
@ -31,15 +31,15 @@ colored = "*"
|
|||
itertools = "*"
|
||||
pairing = "*"
|
||||
rand = "0.4.2"
|
||||
serde = "*"
|
||||
serde = "1"
|
||||
serde_bytes = "*"
|
||||
serde_derive = "*"
|
||||
serde_derive = "1"
|
||||
signifix = "*"
|
||||
futures = "0.1"
|
||||
tokio = "0.1.7"
|
||||
tokio-codec = "*"
|
||||
tokio-io = "*"
|
||||
bincode = "*"
|
||||
bincode = "0.8"
|
||||
tokio-serde = "*"
|
||||
tokio-serde-bincode = "*"
|
||||
bytes = "*"
|
||||
|
@ -52,7 +52,8 @@ clear_on_drop = "*"
|
|||
version = "*"
|
||||
git = "https://github.com/c0gent/hbbft"
|
||||
# git = "https://github.com/poanetwork/hbbft"
|
||||
branch = "master"
|
||||
branch = "c0gent-supertraits"
|
||||
# branch = "master"
|
||||
# branch = "afck-qhb-single"
|
||||
# branch = "afck-agreement"
|
||||
# path = "../hbbft"
|
||||
|
|
21
src/lib.rs
21
src/lib.rs
|
@ -1,6 +1,6 @@
|
|||
#![feature(alloc_system, allocator_api)]
|
||||
// #![feature(alloc_system, allocator_api)]
|
||||
// extern crate alloc_system;
|
||||
|
||||
extern crate alloc_system;
|
||||
extern crate clap;
|
||||
extern crate env_logger;
|
||||
#[macro_use] extern crate log;
|
||||
|
@ -28,10 +28,10 @@ extern crate parking_lot;
|
|||
extern crate clear_on_drop;
|
||||
extern crate hbbft;
|
||||
|
||||
use alloc_system::System;
|
||||
// use alloc_system::System;
|
||||
|
||||
#[global_allocator]
|
||||
static A: System = System;
|
||||
// #[global_allocator]
|
||||
// static A: System = System;
|
||||
|
||||
// pub mod network;
|
||||
pub mod hydrabadger;
|
||||
|
@ -57,7 +57,7 @@ use tokio_io::codec::length_delimited::Framed;
|
|||
use bytes::{BytesMut, Bytes};
|
||||
use rand::{Rng, Rand};
|
||||
use uuid::Uuid;
|
||||
use bincode::{serialize, deserialize};
|
||||
// use bincode::{serialize, deserialize};
|
||||
use hbbft::{
|
||||
crypto::{PublicKey, PublicKeySet},
|
||||
sync_key_gen::{Part, Ack},
|
||||
|
@ -307,7 +307,7 @@ impl Stream for WireMessages {
|
|||
Some(frame) => {
|
||||
Ok(Async::Ready(Some(
|
||||
// deserialize_from(frame.reader()).map_err(Error::Serde)?
|
||||
deserialize(&frame.freeze()).map_err(Error::Serde)?
|
||||
bincode::deserialize(&frame.freeze()).map_err(Error::Serde)?
|
||||
)))
|
||||
}
|
||||
None => Ok(Async::Ready(None))
|
||||
|
@ -322,7 +322,12 @@ impl Sink for WireMessages {
|
|||
fn start_send(&mut self, item: Self::SinkItem) -> StartSend<Self::SinkItem, Self::SinkError> {
|
||||
// TODO: Reuse buffer:
|
||||
let mut serialized = BytesMut::new();
|
||||
match serialize(&item) {
|
||||
|
||||
// Downgraded from bincode 1.0:
|
||||
//
|
||||
// Original: `bincode::serialize(&item)`
|
||||
//
|
||||
match bincode::serialize(&item, bincode::Bounded(1 << 20)) {
|
||||
Ok(s) => serialized.extend_from_slice(&s),
|
||||
Err(err) => return Err(Error::Io(io::Error::new(io::ErrorKind::Other, err))),
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue