Skip to content

Commit

Permalink
Merge #593: Fix halt channel closed after starting HTTP tracker
Browse files Browse the repository at this point in the history
ba4cb34 feat: improve logging for HTTP tracker bootstrapping (Jose Celano)
9f3f949 fix: [#592] halt channel closed after starting HTTP tracker (Jose Celano)

Pull request description:

  Fix "halt" channel closed after starting HTTP tracker.

ACKs for top commit:
  josecelano:
    ACK ba4cb34

Tree-SHA512: e7a2b9ea7f6e73019364f20d2ca513343a9808d3beee4d6dbb898447484101af355696d3394a4f26e0ee9d33e4eadc85f918ffb0181177f953bbdac436eb3b2a
  • Loading branch information
josecelano committed Jan 9, 2024
2 parents a876d8c + ba4cb34 commit 49c961c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/bootstrap/jobs/http_tracker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,10 @@ async fn start_v1(socket: SocketAddr, tls: Option<RustlsConfig>, tracker: Arc<co
.expect("it should be able to start to the http tracker");

tokio::spawn(async move {
assert!(
!server.state.halt_task.is_closed(),
"Halt channel for HTTP tracker should be open"
);
server
.state
.task
Expand Down
6 changes: 6 additions & 0 deletions src/servers/http/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ use axum_server::tls_rustls::RustlsConfig;
use axum_server::Handle;
use derive_more::Constructor;
use futures::future::BoxFuture;
use log::info;
use tokio::sync::oneshot::{Receiver, Sender};

use super::v1::routes::router;
Expand Down Expand Up @@ -51,6 +52,9 @@ impl Launcher {
));

let tls = self.tls.clone();
let protocol = if tls.is_some() { "https" } else { "http" };

info!(target: "HTTP Tracker", "Starting on: {protocol}://{}", address);

let running = Box::pin(async {
match tls {
Expand All @@ -67,6 +71,8 @@ impl Launcher {
}
});

info!(target: "HTTP Tracker", "Started on: {protocol}://{}", address);

tx_start
.send(Started { address })
.expect("the HTTP(s) Tracker service should not be dropped");
Expand Down

0 comments on commit 49c961c

Please sign in to comment.