Upgrade dependencies

This commit is contained in:
Tony Garnock-Jones 2020-05-06 17:14:05 +02:00
parent 708e8fcaf1
commit d05dd10c14
5 changed files with 270 additions and 745 deletions

986
Cargo.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -10,7 +10,8 @@ preserves = "0.3.1"
serde = { version = "1.0", features = ["derive", "rc"] }
serde_bytes = "0.11"
tokio = "0.2.0-alpha"
bytes = "0.4.12"
tokio = { version = "0.2.20", features = ["macros", "rt-threaded", "sync", "dns", "tcp", "time", "stream"] }
tokio-util = { version = "0.3.1", features = ["codec"] }
bytes = "0.5.4"
futures-preview = { version = "=0.3.0-alpha.18", features = ["async-await", "nightly"] }
futures = "0.3.4"

View File

@ -137,7 +137,7 @@ impl Dataspace {
fn deliver_outbound_turns(&mut self, outbound_turns: Map<ConnId, Vec<packets::Event>>) {
for (target, events) in outbound_turns {
let _ = self.peers.get_mut(&target).unwrap().tx.try_send(packets::Out::Turn(events));
let _ = self.peers.get_mut(&target).unwrap().tx.send(packets::Out::Turn(events));
}
}
}

View File

@ -1,7 +1,7 @@
use super::V;
use super::Syndicate;
use bytes::BytesMut;
use bytes::{Buf, BytesMut};
use preserves::value;
use std::io;
use std::sync::Arc;
@ -97,7 +97,7 @@ impl Codec {
}
}
impl tokio::codec::Decoder for Codec {
impl tokio_util::codec::Decoder for Codec {
type Item = In;
type Error = DecodeError;
fn decode(&mut self, bs: &mut BytesMut) -> Result<Option<Self::Item>, Self::Error> {
@ -119,10 +119,10 @@ impl tokio::codec::Decoder for Codec {
}
}
impl tokio::codec::Encoder for Codec {
type Item = Out;
impl tokio_util::codec::Encoder<Out> for Codec
{
type Error = EncodeError;
fn encode(&mut self, item: Self::Item, bs: &mut BytesMut) -> Result<(), Self::Error> {
fn encode(&mut self, item: Out, bs: &mut BytesMut) -> Result<(), Self::Error> {
let v: V = value::to_value(&item)?;
bs.extend(self.codec.encode_bytes(&v)?);
Ok(())

View File

@ -5,14 +5,16 @@ use super::packets;
use super::spaces;
use core::time::Duration;
use futures::FutureExt;
use futures::SinkExt;
use futures::select;
use preserves::value::{self, Map};
use std::sync::{Mutex, Arc};
use tokio::codec::Framed;
use tokio::net::TcpStream;
use tokio::prelude::*;
use tokio::stream::StreamExt;
use tokio::sync::mpsc::{unbounded_channel, UnboundedSender, UnboundedReceiver};
use tokio::timer::Interval;
use tokio::time::interval;
use tokio_util::codec::Framed;
pub struct Peer {
id: ConnId,
@ -55,7 +57,7 @@ impl Peer {
self.space = Some(spaces.lock().unwrap().lookup(&dsname));
self.space.as_ref().unwrap().write().unwrap().register(self.id, self.tx.clone());
let mut ping_timer = Interval::new_interval(Duration::from_secs(60));
let mut ping_timer = interval(Duration::from_secs(60));
let mut running = true;
while running {