From 84f30cd43847a2466033ab67c44c75090b5da1d9 Mon Sep 17 00:00:00 2001 From: Carlos Alejandro Gutierrez Sandoval Date: Sat, 17 Aug 2024 11:41:30 -0600 Subject: [PATCH] update deps --- Cargo.toml | 2 +- src/net/streaming.rs | 3 +-- src/net/ws_adapter.rs | 6 +++--- src/servers/mod.rs | 3 +-- 4 files changed, 6 insertions(+), 8 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index ffbb94a..0621730 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -15,7 +15,7 @@ reqwest = { version = "^0.12", default-features = false, features = [ "native-tls-vendored", ] } tokio = { version = "1.20.1", features = ["rt", "macros", "rt-multi-thread"] } -tokio-tungstenite = { version = "0.18", features = ["native-tls-vendored"] } +tokio-tungstenite = { version = "^0", features = ["native-tls-vendored"] } tracing = { version = "0.1.36", features = ["attributes"] } tracing-subscriber = { version = "0.3.17", features = ["env-filter"] } url = "2.2.2" diff --git a/src/net/streaming.rs b/src/net/streaming.rs index d1b172f..dbc63d8 100644 --- a/src/net/streaming.rs +++ b/src/net/streaming.rs @@ -11,7 +11,6 @@ use tokio_tungstenite::MaybeTlsStream; use tokio_tungstenite::WebSocketStream; use tracing::debug; use tracing::{error, info}; -use url::Url; pub(crate) struct MultiSymbolStream; @@ -63,7 +62,7 @@ impl MultiSymbolStream { P: Endpoints + Sync, { let mut stream = { - let url = Url::parse(provider.websocket_url().as_str()).expect("invalid websocket"); + let url = provider.websocket_url().parse().expect("invalid websocket"); connect(url).await.expect("stream") }; diff --git a/src/net/ws_adapter.rs b/src/net/ws_adapter.rs index e8c4ed5..a721cc4 100644 --- a/src/net/ws_adapter.rs +++ b/src/net/ws_adapter.rs @@ -1,3 +1,4 @@ +use http::Uri; use tokio::net::TcpStream; use tokio_tungstenite::{ connect_async_tls_with_config, @@ -5,13 +6,12 @@ use tokio_tungstenite::{ MaybeTlsStream, WebSocketStream, }; use tracing::debug; -use url::Url; type WebSocket = WebSocketStream>; -pub async fn connect(ws_uri: Url) -> Result, Error> { +pub async fn connect(ws_uri: Uri) -> Result, Error> { let (socket, res): (WebSocket<_>, _) = - connect_async_tls_with_config(ws_uri, None, None).await?; + connect_async_tls_with_config(ws_uri, None, false, None).await?; debug!("Connection response: {res:?}"); Ok(socket) } diff --git a/src/servers/mod.rs b/src/servers/mod.rs index 9c0685d..b6e621f 100644 --- a/src/servers/mod.rs +++ b/src/servers/mod.rs @@ -10,7 +10,6 @@ use hyper_util::rt::{TokioExecutor, TokioIo, TokioTimer}; use left_right::ReadHandleFactory; use std::collections::HashMap; use std::net::Ipv6Addr; -use std::time::Duration; use tokio::sync::mpsc::UnboundedReceiver; use tower::Service; use tracing::{error, info, warn}; @@ -88,7 +87,7 @@ async fn inner_start( tower_service.clone().call(req) }); - let mut builder = hyper_util::server::conn::auto::Builder::new(TokioExecutor::new()); + let builder = hyper_util::server::conn::auto::Builder::new(TokioExecutor::new()); //builder.keep_alive_interval(Some(Duration::from_millis(500))); //builder.timer(TokioTimer::new());