feat(lib): update Tokio, bytes, http, h2, and http-body
This commit is contained in:
@@ -9,7 +9,6 @@ use std::sync::mpsc;
|
||||
use std::time::Duration;
|
||||
|
||||
use futures_util::{stream, StreamExt};
|
||||
use tokio::runtime::current_thread;
|
||||
use tokio::sync::oneshot;
|
||||
|
||||
use hyper::{Body, Response, Server};
|
||||
@@ -33,8 +32,17 @@ macro_rules! bench_server {
|
||||
)
|
||||
}))
|
||||
});
|
||||
let srv = Server::bind(&addr)
|
||||
.serve(make_svc);
|
||||
|
||||
let mut rt = tokio::runtime::Builder::new()
|
||||
.enable_all()
|
||||
.basic_scheduler()
|
||||
.build()
|
||||
.expect("rt build");
|
||||
|
||||
let srv = rt.block_on(async move {
|
||||
Server::bind(&addr)
|
||||
.serve(make_svc)
|
||||
});
|
||||
|
||||
addr_tx.send(srv.local_addr()).unwrap();
|
||||
|
||||
@@ -42,13 +50,11 @@ macro_rules! bench_server {
|
||||
.with_graceful_shutdown(async {
|
||||
until_rx.await.ok();
|
||||
});
|
||||
let mut rt = current_thread::Runtime::new().unwrap();
|
||||
rt.spawn(async {
|
||||
rt.block_on(async move {
|
||||
if let Err(e) = graceful.await {
|
||||
panic!("server error: {}", e);
|
||||
}
|
||||
});
|
||||
rt.run().unwrap();
|
||||
});
|
||||
|
||||
addr_rx.recv().unwrap()
|
||||
|
||||
Reference in New Issue
Block a user