From e1113dd5e2ec2eb803a1e5d18ca2b5d580c5552b Mon Sep 17 00:00:00 2001 From: George Hahn Date: Thu, 6 Jun 2024 21:37:26 -0600 Subject: [PATCH] cargo fmt --- audio/src/fetch/receive.rs | 2 +- core/src/http_client.rs | 10 +++++----- discovery/src/server.rs | 9 +++------ 3 files changed, 9 insertions(+), 12 deletions(-) diff --git a/audio/src/fetch/receive.rs b/audio/src/fetch/receive.rs index 4023060d..5f92380a 100644 --- a/audio/src/fetch/receive.rs +++ b/audio/src/fetch/receive.rs @@ -7,10 +7,10 @@ use std::{ use bytes::Bytes; use futures_util::StreamExt; +use http_body_util::BodyExt; use hyper::StatusCode; use tempfile::NamedTempFile; use tokio::sync::{mpsc, oneshot}; -use http_body_util::BodyExt; use librespot_core::{http_client::HttpClient, session::Session, Error}; diff --git a/core/src/http_client.rs b/core/src/http_client.rs index 362bf453..4b500cd6 100644 --- a/core/src/http_client.rs +++ b/core/src/http_client.rs @@ -11,12 +11,13 @@ use governor::{ }; use http::{header::HeaderValue, Uri}; use http_body_util::{BodyExt, Full}; -use hyper::{ - body::Incoming, header::USER_AGENT, HeaderMap, Request, Response, StatusCode -}; +use hyper::{body::Incoming, header::USER_AGENT, HeaderMap, Request, Response, StatusCode}; use hyper_proxy2::{Intercept, Proxy, ProxyConnector}; use hyper_rustls::{HttpsConnector, HttpsConnectorBuilder}; -use hyper_util::{client::legacy::{connect::HttpConnector, Client, ResponseFuture}, rt::TokioExecutor}; +use hyper_util::{ + client::legacy::{connect::HttpConnector, Client, ResponseFuture}, + rt::TokioExecutor, +}; use nonzero_ext::nonzero; use once_cell::sync::OnceCell; use parking_lot::Mutex; @@ -249,7 +250,6 @@ impl HttpClient { )) })?; - Ok(self.hyper_client()?.request(req.map(Full::new))) } diff --git a/discovery/src/server.rs b/discovery/src/server.rs index 29fcbcff..6167275d 100644 --- a/discovery/src/server.rs +++ b/discovery/src/server.rs @@ -16,9 +16,7 @@ use futures_core::Stream; use futures_util::{FutureExt, TryFutureExt}; use hmac::{Hmac, Mac}; use http_body_util::{BodyExt, Full}; -use hyper::{ - body::Incoming, Method, Request, Response, StatusCode -}; +use hyper::{body::Incoming, Method, Request, Response, StatusCode}; use hyper_util::{rt::TokioIo, server::graceful::GracefulShutdown}; use log::{debug, error, warn}; @@ -246,7 +244,7 @@ impl DiscoveryServer { pub fn new(config: Config, port: &mut u16) -> Result { let (discovery, cred_rx) = RequestHandler::new(config); let address = SocketAddr::new(Ipv4Addr::UNSPECIFIED.into(), *port); - + let (close_tx, close_rx) = oneshot::channel(); let listener = match TcpListener::bind(address) { @@ -271,10 +269,9 @@ impl DiscoveryServer { } } - tokio::spawn(async move { let discovery = Arc::new(discovery); - + let server = hyper::server::conn::http1::Builder::new(); let graceful = GracefulShutdown::new(); let mut close_rx = std::pin::pin!(close_rx);