Upgrade to tokio 0.2 (#163)

This commit is contained in:
Lucio Franco
2019-12-06 00:09:46 -05:00
committed by GitHub
parent 4471a5f19c
commit 3387ef900f
30 changed files with 297 additions and 282 deletions
+5 -5
View File
@@ -71,11 +71,11 @@ tonic = { path = "../tonic", features = ["tls"] }
bytes = "0.4"
prost = "0.5"
tokio = "=0.2.0-alpha.6"
futures-preview = { version = "=0.3.0-alpha.19", default-features = false, features = ["alloc"]}
async-stream = "0.1.2"
http = "0.1"
tower = "=0.3.0-alpha.2"
tokio = { version = "0.2", features = ["rt-threaded", "time", "stream", "fs"] }
futures = { version = "0.3", default-features = false, features = ["alloc"]}
async-stream = "0.2"
http = "0.2"
tower = { git = "https://github.com/tower-rs/tower" }
# Required for routeguide
serde = { version = "1.0", features = ["derive"] }
+2 -2
View File
@@ -60,7 +60,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
for addr in &addrs {
let addr = addr.parse()?;
let mut tx = tx.clone();
let tx = tx.clone();
let server = EchoServer { addr };
let serve = Server::builder()
@@ -72,7 +72,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
eprintln!("Error = {:?}", e);
}
tx.try_send(()).unwrap();
tx.send(()).unwrap();
});
}
+4 -4
View File
@@ -3,8 +3,8 @@ use rand::rngs::ThreadRng;
use rand::Rng;
use route_guide::{Point, Rectangle, RouteNote};
use std::error::Error;
use std::time::{Duration, Instant};
use tokio::timer::Interval;
use std::time::Duration;
use tokio::time::Instant;
use tonic::transport::Channel;
use tonic::Request;
@@ -62,9 +62,9 @@ async fn run_route_chat(client: &mut RouteGuideClient<Channel>) -> Result<(), Bo
let start = Instant::now();
let outbound = async_stream::stream! {
let mut interval = Interval::new_interval(Duration::from_secs(1));
let mut interval = tokio::time::interval(Duration::from_secs(1));
while let Some(time) = interval.next().await {
while let time = interval.tick().await {
let elapsed = time.duration_since(start);
let note = RouteNote {
location: Some(Point {