Improvements to the helpers in upgrade::transfer (#937)

* Improvements to the helpers in upgrade::transfer

* Fix floodsub
This commit is contained in:
Pierre Krieger
2019-02-14 11:00:46 +01:00
committed by GitHub
parent e9535c5c02
commit 3548c29dcf
3 changed files with 116 additions and 39 deletions

View File

@ -53,11 +53,11 @@ where
{
type Output = FloodsubRpc;
type Error = FloodsubDecodeError;
type Future = upgrade::ReadOneThen<TSocket, fn(Vec<u8>) -> Result<FloodsubRpc, FloodsubDecodeError>>;
type Future = upgrade::ReadOneThen<TSocket, (), fn(Vec<u8>, ()) -> Result<FloodsubRpc, FloodsubDecodeError>>;
#[inline]
fn upgrade_inbound(self, socket: TSocket, _: Self::Info) -> Self::Future {
upgrade::read_one_then(socket, 2048, |packet| {
upgrade::read_one_then(socket, 2048, (), |packet, ()| {
let mut rpc: rpc_proto::RPC = protobuf::parse_from_bytes(&packet)?;
let mut messages = Vec::with_capacity(rpc.get_publish().len());