Skip to content

Commit 25e0c6c

Browse files
committed
Respect the port number from VoiceServerUpdate
1 parent 8741608 commit 25e0c6c

File tree

1 file changed

+4
-10
lines changed

1 file changed

+4
-10
lines changed

src/driver/connection/mod.rs

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -53,12 +53,12 @@ impl Connection {
5353
}
5454

5555
pub(crate) async fn new_inner(
56-
mut info: ConnectionInfo,
56+
info: ConnectionInfo,
5757
interconnect: &Interconnect,
5858
config: &Config,
5959
idx: usize,
6060
) -> Result<Connection> {
61-
let url = generate_url(&mut info.endpoint)?;
61+
let url = generate_url(&info.endpoint)?;
6262

6363
let mut client = WsStream::connect(url).await?;
6464
let (ws_msg_tx, ws_msg_rx) = flume::unbounded();
@@ -272,7 +272,7 @@ impl Connection {
272272

273273
#[instrument(skip(self))]
274274
pub async fn reconnect_inner(&mut self) -> Result<()> {
275-
let url = generate_url(&mut self.info.endpoint)?;
275+
let url = generate_url(&self.info.endpoint)?;
276276

277277
// Thread may have died, we want to send to prompt a clean exit
278278
// (if at all possible) and then proceed as normal.
@@ -331,13 +331,7 @@ impl Drop for Connection {
331331
}
332332
}
333333

334-
fn generate_url(endpoint: &mut String) -> Result<Url> {
335-
if endpoint.ends_with(":80") {
336-
let len = endpoint.len();
337-
338-
endpoint.truncate(len - 3);
339-
}
340-
334+
fn generate_url(endpoint: &str) -> Result<Url> {
341335
Url::parse(&format!("wss://{endpoint}/?v={VOICE_GATEWAY_VERSION}")).or(Err(Error::EndpointUrl))
342336
}
343337

0 commit comments

Comments
 (0)