Crate docs for servers::http module#268
Merged
josecelano merged 1 commit intotorrust:developfrom Apr 4, 2023
Merged
Conversation
5abf54b to
d5d6996
Compare
Member
Author
|
Hi @da2ce7 @WarmBeer , for the time being, I'm not going to write docs for these modules: The torrust_tracker::servers::http::v1::launcher::Launcher is used only for testing, and it would be not very clear to add documentation since the test code does not appear in the documentation unless you add it as a doc comment. Regarding the src/servers/http/server.rs, the pub fn start(socket_addr: std::net::SocketAddr, tracker: Arc<Tracker>) -> impl Future<Output = hyper::Result<()>> {
let app = router(tracker);
let server = axum::Server::bind(&socket_addr).serve(app.into_make_service_with_connect_info::<std::net::SocketAddr>());
server.with_graceful_shutdown(async move {
tokio::signal::ctrl_c().await.expect("Failed to listen to shutdown signal.");
info!("Stopping Torrust HTTP tracker server on http://{} ...", socket_addr);
})
}
pub fn start_tls(
socket_addr: std::net::SocketAddr,
ssl_config: RustlsConfig,
tracker: Arc<Tracker>,
) -> impl Future<Output = Result<(), std::io::Error>> {
let app = router(tracker);
let handle = Handle::new();
let shutdown_handle = handle.clone();
tokio::spawn(async move {
tokio::signal::ctrl_c().await.expect("Failed to listen to shutdown signal.");
info!("Stopping Torrust HTTP tracker server on https://{} ...", socket_addr);
shutdown_handle.shutdown();
});
axum_server::bind_rustls(socket_addr, ssl_config)
.handle(handle)
.serve(app.into_make_service_with_connect_info::<std::net::SocketAddr>())
}We can either:
I'd do the second after merging this PR and them and the documentation for the remaining code. |
db288cd to
f001f0f
Compare
f001f0f to
11d8731
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Documentation for the
crate::servers::httpmodule. The HTTP tracker.