Skip to content

Commit

Permalink
build(gateway, lavalink): Update to tokio-websockets 0.5 and rustls 0.22
Browse files Browse the repository at this point in the history
Signed-off-by: Jens Reidel <[email protected]>
  • Loading branch information
Gelbpunkt committed Dec 11, 2023
1 parent 0fbb8b9 commit 01fce6c
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 13 deletions.
6 changes: 3 additions & 3 deletions twilight-gateway/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ futures-util = { default-features = false, features = ["sink", "std"], version =
serde = { default-features = false, features = ["derive"], version = "1" }
serde_json = { default-features = false, features = ["std"], version = "1" }
tokio = { default-features = false, features = ["net", "rt", "sync", "time"], version = "1.19" }
tokio-websockets = { default-features = false, features = ["client", "fastrand", "sha1_smol", "simd"], version = "0.4" }
tokio-websockets = { default-features = false, features = ["client", "fastrand", "sha1_smol", "simd"], version = "0.5" }
tracing = { default-features = false, features = ["std", "attributes"], version = "0.1" }
twilight-gateway-queue = { default-features = false, path = "../twilight-gateway-queue", version = "0.15.4" }
twilight-model = { default-features = false, path = "../twilight-model", version = "0.15.4" }
Expand All @@ -45,8 +45,8 @@ tracing-subscriber = { default-features = false, features = ["fmt", "tracing-log
[features]
default = ["rustls-native-roots", "twilight-http", "zlib-stock"]
native = ["tokio-websockets/native-tls", "tokio-websockets/openssl"]
rustls-native-roots = ["tokio-websockets/rustls-native-roots"]
rustls-webpki-roots = ["tokio-websockets/rustls-webpki-roots"]
rustls-native-roots = ["tokio-websockets/ring", "tokio-websockets/rustls-native-roots"]
rustls-webpki-roots = ["tokio-websockets/ring", "tokio-websockets/rustls-webpki-roots"]
zlib-simd = ["dep:flate2", "flate2?/zlib-ng"]
zlib-stock = ["dep:flate2", "flate2?/zlib"]

Expand Down
4 changes: 2 additions & 2 deletions twilight-gateway/src/connection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use crate::{
};
use std::fmt::{Display, Formatter, Result as FmtResult};
use tokio::net::TcpStream;
use tokio_websockets::{ClientBuilder, Connector, Limits, MaybeTlsStream, WebsocketStream};
use tokio_websockets::{ClientBuilder, Connector, Limits, MaybeTlsStream, WebSocketStream};

/// Query argument with zlib-stream enabled.
#[cfg(any(feature = "zlib-stock", feature = "zlib-simd"))]
Expand All @@ -24,7 +24,7 @@ const GATEWAY_URL: &str = "wss://gateway.discord.gg";
/// Connections are used by [`Shard`]s when reconnecting.
///
/// [`Shard`]: crate::Shard
pub type Connection = WebsocketStream<MaybeTlsStream<TcpStream>>;
pub type Connection = WebSocketStream<MaybeTlsStream<TcpStream>>;

/// Formatter for a gateway URL, with the API version and compression features
/// specified.
Expand Down
8 changes: 4 additions & 4 deletions twilight-lavalink/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ version = "0.15.3"
[dependencies]
dashmap = { default-features = false, version = "5.3" }
futures-util = { default-features = false, features = ["bilock", "sink", "std", "unstable"], version = "0.3" }
http = { default-features = false, version = "0.2" }
http = { default-features = false, version = "1" }
serde = { default-features = false, features = ["derive", "std"], version = "1" }
serde_json = { default-features = false, features = ["std"], version = "1" }
tokio = { default-features = false, features = ["macros", "net", "rt", "sync", "time"], version = "1.0" }
tokio-websockets = { default-features = false, features = ["client", "fastrand", "sha1_smol", "simd"], version = "0.4" }
tokio-websockets = { default-features = false, features = ["client", "fastrand", "sha1_smol", "simd"], version = "0.5" }
tracing = { default-features = false, features = ["std", "attributes"], version = "0.1" }
twilight-model = { default-features = false, path = "../twilight-model", version = "0.15.4" }

Expand All @@ -40,8 +40,8 @@ twilight-http = { default-features = false, features = ["rustls-native-roots"],
default = ["http-support", "rustls-native-roots"]
http-support = ["dep:percent-encoding"]
native = ["tokio-websockets/native-tls", "tokio-websockets/openssl"]
rustls-native-roots = ["tokio-websockets/rustls-native-roots"]
rustls-webpki-roots = ["tokio-websockets/rustls-webpki-roots"]
rustls-native-roots = ["tokio-websockets/ring", "tokio-websockets/rustls-native-roots"]
rustls-webpki-roots = ["tokio-websockets/ring", "tokio-websockets/rustls-webpki-roots"]

[package.metadata.docs.rs]
all-features = true
Expand Down
8 changes: 4 additions & 4 deletions twilight-lavalink/src/node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ use tokio::{
time as tokio_time,
};
use tokio_websockets::{
upgrade, ClientBuilder, Error as WebsocketError, MaybeTlsStream, Message, WebsocketStream,
upgrade, ClientBuilder, Error as WebsocketError, MaybeTlsStream, Message, WebSocketStream,
};
use twilight_model::id::{marker::UserMarker, Id};

Expand Down Expand Up @@ -464,7 +464,7 @@ impl Node {

struct Connection {
config: NodeConfig,
connection: WebsocketStream<MaybeTlsStream<TcpStream>>,
connection: WebSocketStream<MaybeTlsStream<TcpStream>>,
node_from: UnboundedReceiver<OutgoingEvent>,
node_to: UnboundedSender<IncomingEvent>,
players: PlayerManager,
Expand Down Expand Up @@ -635,7 +635,7 @@ fn connect_request(state: &NodeConfig) -> Result<ClientBuilder, NodeError> {

async fn reconnect(
config: &NodeConfig,
) -> Result<WebsocketStream<MaybeTlsStream<TcpStream>>, NodeError> {
) -> Result<WebSocketStream<MaybeTlsStream<TcpStream>>, NodeError> {
let (mut stream, res) = backoff(config).await?;

let headers = res.headers();
Expand Down Expand Up @@ -668,7 +668,7 @@ async fn backoff(
config: &NodeConfig,
) -> Result<
(
WebsocketStream<MaybeTlsStream<TcpStream>>,
WebSocketStream<MaybeTlsStream<TcpStream>>,
upgrade::Response,
),
NodeError,
Expand Down

0 comments on commit 01fce6c

Please sign in to comment.