Skip to content

Commit

Permalink
chore: update rustc to nightly-2023-03-13 after rustc fix
Browse files Browse the repository at this point in the history
* Now that <rust-lang/rust#108721> is landed
  on rust master, we can push the nightly version to bleeding edge again
  • Loading branch information
phlip9 committed Mar 14, 2023
1 parent d0d97c6 commit a5a295a
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 9 deletions.
5 changes: 2 additions & 3 deletions common/src/api/rest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,8 @@ where
// Instead of giving the graceful shutduwn future to hyper directly, we
// let the spawned task wait on it so that we can enforce a hyper timeout.
let shutdown = ShutdownChannel::new();
let mut shutdown_clone = shutdown.clone();
let server_shutdown_fut = async move { shutdown_clone.recv().await };
let graceful_server = server.with_graceful_shutdown(server_shutdown_fut);
let graceful_server =
server.with_graceful_shutdown(shutdown.clone().recv_owned());
let task = LxTask::spawn_named_with_span(task_name, span, async move {
tokio::pin!(graceful_server);
tokio::select! {
Expand Down
4 changes: 4 additions & 0 deletions common/src/shutdown.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,10 @@ impl ShutdownChannel {
}
}

pub async fn recv_owned(mut self) {
self.recv().await
}

/// Immediately returns whether a shutdown signal has been sent.
pub fn try_recv(&self) -> bool {
self.inner.is_closed()
Expand Down
3 changes: 2 additions & 1 deletion node/src/event_handler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ impl EventHandler for NodeEventHandler {
debug!("Event details: {event:?}");

// TODO(max): Should be possible to remove all clone()s once async event
// handlilng is supported
// handling is supported
let lsp = self.lsp.clone();
let wallet = self.wallet.clone();
let channel_manager = self.channel_manager.clone();
Expand All @@ -93,6 +93,7 @@ impl EventHandler for NodeEventHandler {
// node handles events. So we hack around it by breaking the contract
// and just handling the event in a detached task. The long term fix is
// to move to async event handling, which should be straightforward.
#[allow(clippy::redundant_async_block)]
LxTask::spawn(async move {
handle_event(
&lsp,
Expand Down
6 changes: 2 additions & 4 deletions node/src/run.rs
Original file line number Diff line number Diff line change
Expand Up @@ -371,14 +371,13 @@ impl UserNode {
args.network,
activity_tx,
);
let mut owner_shutdown = shutdown.clone();
let (owner_addr, owner_service_fut) = warp::serve(owner_routes)
.tls()
.preconfigured_tls(owner_tls)
// A value of 0 indicates that the OS will assign a port for us
.bind_with_graceful_shutdown(
([127, 0, 0, 1], args.owner_port.unwrap_or(0)),
async move { owner_shutdown.recv().await },
shutdown.clone().recv_owned(),
);
let owner_port = owner_addr.port();
info!("Owner service listening on port {}", owner_port);
Expand All @@ -387,12 +386,11 @@ impl UserNode {
// TODO(phlip9): authenticate host<->node
// Start warp service for host
let host_routes = server::host_routes(args.user_pk, shutdown.clone());
let mut host_shutdown = shutdown.clone();
let (host_addr, host_service_fut) = warp::serve(host_routes)
// A value of 0 indicates that the OS will assign a port for us
.try_bind_with_graceful_shutdown(
([127, 0, 0, 1], args.host_port.unwrap_or(0)),
async move { host_shutdown.recv().await },
shutdown.clone().recv_owned(),
)
.context("Failed to bind warp")?;
let host_port = host_addr.port();
Expand Down
2 changes: 1 addition & 1 deletion rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[toolchain]
channel = "nightly-2023-02-08"
channel = "nightly-2023-03-13"
components = ["clippy", "rustfmt"]
targets = [
# # Remote azure host target
Expand Down

0 comments on commit a5a295a

Please sign in to comment.