From fbc8e689d49140312c8da7584f6b7025681806f1 Mon Sep 17 00:00:00 2001 From: Harald Hoyer Date: Thu, 20 Mar 2025 15:49:38 +0100 Subject: [PATCH] refactor: remove tokio TcpListener and simplify address setup - Replaced `tokio::net::TcpListener` with direct `SocketAddr` setup. - Simplified server address configuration while maintaining functionality. - Reduced unnecessary dependencies for cleaner API handling. --- src/api.rs | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/src/api.rs b/src/api.rs index 7e6538b..f632b54 100644 --- a/src/api.rs +++ b/src/api.rs @@ -9,7 +9,6 @@ use axum::{ }; use serde::{Deserialize, Serialize}; use std::sync::Arc; -use tokio::net::TcpListener; use tracing::{info, error, debug, instrument}; use crate::document_service::{Document, DocumentService, SignatureVerification}; @@ -106,12 +105,8 @@ pub async fn start_api( info!("API routes configured"); - // Start server - let listener = TcpListener::bind(format!("0.0.0.0:{}", api_port)).await?; - info!("API server started on port {}", api_port); - // Get the socket address - let addr = listener.local_addr()?; + let addr = std::net::SocketAddr::from(([0, 0, 0, 0], api_port)); // Bind and serve info!("Serving API at {}", addr);