Respect the port number from VoiceServerUpdate (#285)
Some checks failed
CI / Lint (push) Has been cancelled
CI / Test (beta, beta) (push) Has been cancelled
CI / Test (nightly, nightly) (push) Has been cancelled
CI / Test (stable) (push) Has been cancelled
CI / Test (true, Windows, windows-latest) (push) Has been cancelled
CI / Test (true, driver tungstenite rustls, driver only) (push) Has been cancelled
CI / Test (true, gateway serenity tungstenite rustls, gateway only) (push) Has been cancelled
CI / Test (true, macOS, macOS-latest) (push) Has been cancelled
CI / Build docs (push) Has been cancelled
CI / Examples (push) Has been cancelled
Publish docs / Publish docs (push) Has been cancelled

This commit is contained in:
Gnome!
2025-07-26 00:00:23 +01:00
committed by GitHub
parent c910d7087d
commit 18c282e676

View File

@@ -53,12 +53,12 @@ impl Connection {
}
pub(crate) async fn new_inner(
mut info: ConnectionInfo,
info: ConnectionInfo,
interconnect: &Interconnect,
config: &Config,
idx: usize,
) -> Result<Connection> {
let url = generate_url(&mut info.endpoint)?;
let url = generate_url(&info.endpoint)?;
let mut client = WsStream::connect(url).await?;
let (ws_msg_tx, ws_msg_rx) = flume::unbounded();
@@ -272,7 +272,7 @@ impl Connection {
#[instrument(skip(self))]
pub async fn reconnect_inner(&mut self) -> Result<()> {
let url = generate_url(&mut self.info.endpoint)?;
let url = generate_url(&self.info.endpoint)?;
// Thread may have died, we want to send to prompt a clean exit
// (if at all possible) and then proceed as normal.
@@ -331,13 +331,7 @@ impl Drop for Connection {
}
}
fn generate_url(endpoint: &mut String) -> Result<Url> {
if endpoint.ends_with(":80") {
let len = endpoint.len();
endpoint.truncate(len - 3);
}
fn generate_url(endpoint: &str) -> Result<Url> {
Url::parse(&format!("wss://{endpoint}/?v={VOICE_GATEWAY_VERSION}")).or(Err(Error::EndpointUrl))
}