Skip to content
This repository was archived by the owner on Aug 19, 2025. It is now read-only.

Commit a3b6865

Browse files
committed
server: update to axum v0.8
1 parent 75a4110 commit a3b6865

File tree

3 files changed

+18
-14
lines changed

3 files changed

+18
-14
lines changed

Cargo.lock

Lines changed: 8 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dxr_server/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ http = "1.0"
1818
log = "0.4"
1919

2020
# axum support
21-
axum = { version = "0.7", optional = true }
21+
axum = { version = "0.8", optional = true }
2222
hyper = { version = "1.0", optional = true }
2323
thiserror = { version = "1.0", optional = true }
2424
tokio = { version = "1.14", features = ["sync"], optional = true }

dxr_server/src/axum_support.rs

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ use std::sync::Arc;
2424

2525
use axum::http::HeaderMap;
2626
use axum::routing::post;
27+
use axum::serve::Listener;
2728
use axum::Router;
2829

2930
use thiserror::Error;
@@ -139,18 +140,22 @@ impl Server {
139140
self.serve_listener(listener).await
140141
}
141142

142-
/// This method launches a server that uses the supplied [`TcpListener`] and with the
143+
/// This method launches a server that uses the supplied [`Listener`] and with the
143144
/// configured route of the XML-RPC endpoint as the only route that will accept requests.
144145
///
145146
/// Requests with invalid input, calls of unknown methods, and failed methods are converted
146147
/// into fault responses.
147-
pub async fn serve_listener(self, listener: TcpListener) -> Result<(), ServerError> {
148+
pub async fn serve_listener<L>(self, listener: L) -> Result<(), ServerError>
149+
where
150+
L: Listener,
151+
L::Addr: Debug,
152+
{
148153
if let Some(barrier) = self.barrier {
149-
Ok(axum::serve(listener, self.route.into_make_service())
154+
Ok(axum::serve(listener, self.route)
150155
.with_graceful_shutdown(async move { barrier.notified().await })
151156
.await?)
152157
} else {
153-
Ok(axum::serve(listener, self.route.into_make_service()).await?)
158+
Ok(axum::serve(listener, self.route).await?)
154159
}
155160
}
156161
}

0 commit comments

Comments
 (0)