Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions dropshot/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,10 @@ repository = "https://github.com/oxidecomputer/dropshot/"
[dependencies]
async-trait = "0.1.24"
base64 = "0.12.3"
bytes = "0.5.4"
bytes = "1"
futures = "0.3.1"
hostname = "0.3.0"
http = "0.2.0"
hyper = "0.13.0"
indexmap = "1.0.0"
openapiv3 = "0.3.0"
paste = "1.0.0"
Expand All @@ -34,6 +33,10 @@ features = [ "serde" ]
version = "0.3.0"
path = "../dropshot_endpoint"

[dependencies.hyper]
version = "0.14"
features = [ "full" ]

[dependencies.serde]
version = "1.0.0"
features = [ "derive" ]
Expand All @@ -43,7 +46,7 @@ version = "2.5.0"
features = [ "max_level_trace", "release_max_level_debug" ]

[dependencies.tokio]
version = "0.2.0"
version = "1.0"
features = [ "full" ]

[dependencies.uuid]
Expand Down
2 changes: 1 addition & 1 deletion dropshot/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
* errors into HttpErrors.
*/

use hyper::error::Error as HyperError;
use hyper::Error as HyperError;
use serde::Deserialize;
use serde::Serialize;

Expand Down
2 changes: 1 addition & 1 deletion dropshot/src/http_util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ pub async fn http_read_body<T>(
cap: usize,
) -> Result<Bytes, HttpError>
where
T: HttpBody<Data = Bytes, Error = hyper::error::Error> + std::marker::Unpin,
T: HttpBody<Data = Bytes, Error = hyper::Error> + std::marker::Unpin,
{
/*
* This looks a lot like the implementation of hyper::body::to_bytes(), but
Expand Down
10 changes: 4 additions & 6 deletions dropshot/src/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ pub struct ServerConfig {
*/
pub struct HttpServer {
app_state: Arc<DropshotState>,
server_future: Option<BoxFuture<'static, Result<(), hyper::error::Error>>>,
server_future: Option<BoxFuture<'static, Result<(), hyper::Error>>>,
local_addr: SocketAddr,
close_channel: Option<tokio::sync::oneshot::Sender<()>>,
}
Expand All @@ -94,17 +94,15 @@ impl HttpServer {
* TODO-cleanup is it more accurate to call this start() and say it returns
* a Future that resolves when the server is finished?
*/
pub fn run(
&mut self,
) -> tokio::task::JoinHandle<Result<(), hyper::error::Error>> {
pub fn run(&mut self) -> tokio::task::JoinHandle<Result<(), hyper::Error>> {
let future =
self.server_future.take().expect("cannot run() more than once");
tokio::spawn(async { future.await })
}

pub async fn wait_for_shutdown(
&mut self,
join_handle: tokio::task::JoinHandle<Result<(), hyper::error::Error>>,
join_handle: tokio::task::JoinHandle<Result<(), hyper::Error>>,
) -> Result<(), String> {
let join_result = join_handle
.await
Expand All @@ -126,7 +124,7 @@ impl HttpServer {
api: ApiDescription,
private: Arc<dyn Any + Send + Sync + 'static>,
log: &Logger,
) -> Result<HttpServer, hyper::error::Error> {
) -> Result<HttpServer, hyper::Error> {
/* TODO-cleanup too many Arcs? */
let log_close = log.new(o!());
let app_state = Arc::new(DropshotState {
Expand Down
2 changes: 1 addition & 1 deletion dropshot/src/test_util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -411,7 +411,7 @@ pub struct TestContext {
pub client_testctx: ClientTestContext,
pub server: HttpServer,
pub log: Logger,
server_task: JoinHandle<Result<(), hyper::error::Error>>,
server_task: JoinHandle<Result<(), hyper::Error>>,
log_context: Option<LogContext>,
}

Expand Down
2 changes: 1 addition & 1 deletion dropshot/tests/test_pagination.rs
Original file line number Diff line number Diff line change
Expand Up @@ -942,7 +942,7 @@ async fn start_example(path: &str, port: u16) -> ExampleContext {
return rv;
}

tokio::time::delay_for(Duration::from_millis(500)).await;
tokio::time::sleep(Duration::from_millis(500)).await;
}

panic!(
Expand Down