Driver: Don't trim recv_buffer on MacOS

This should fix #193 -- it seems that a zero-size recv buffer is an invalid argument as far as darwin is concerned.

Tested with `cargo make ready`.
This commit is contained in:
Kyle Simpson
2023-08-08 20:48:46 +01:00
parent 02c9812c3e
commit 019ac27a85

View File

@@ -75,7 +75,9 @@ impl Connection {
.await?;
loop {
let Some(value) = client.recv_json().await? else { continue };
let Some(value) = client.recv_json().await? else {
continue;
};
match value {
GatewayEvent::Ready(r) => {
@@ -112,7 +114,10 @@ impl Connection {
udp
} else {
let socket = Socket::from(udp.into_std()?);
#[cfg(not(target_os = "macos"))]
socket.set_recv_buffer_size(0)?;
UdpSocket::from_std(socket.into())?
};
@@ -279,7 +284,9 @@ impl Connection {
let mut resumed = None;
loop {
let Some(value) = client.recv_json().await? else { continue };
let Some(value) = client.recv_json().await? else {
continue;
};
match value {
GatewayEvent::Resumed => {
@@ -331,7 +338,9 @@ fn generate_url(endpoint: &mut String) -> Result<Url> {
#[inline]
async fn init_cipher(client: &mut WsStream, mode: CryptoMode) -> Result<Cipher> {
loop {
let Some(value) = client.recv_json().await? else { continue };
let Some(value) = client.recv_json().await? else {
continue;
};
match value {
GatewayEvent::SessionDescription(desc) => {