Fix idkx
This commit is contained in:
+18
-1
@@ -49,6 +49,11 @@ pub enum ClientMethod {
|
|||||||
pin: u64,
|
pin: u64,
|
||||||
},
|
},
|
||||||
|
|
||||||
|
UserJoinedVoice {
|
||||||
|
channel_id: String,
|
||||||
|
pubkey: String,
|
||||||
|
},
|
||||||
|
|
||||||
Speaking {
|
Speaking {
|
||||||
pubkey: String,
|
pubkey: String,
|
||||||
},
|
},
|
||||||
@@ -167,6 +172,7 @@ pub async fn read_loop(
|
|||||||
}
|
}
|
||||||
|
|
||||||
ServerMethod::JoinVoice { channel_id } => {
|
ServerMethod::JoinVoice { channel_id } => {
|
||||||
|
{
|
||||||
let pin = rand::random::<u64>() % (1 << 53);
|
let pin = rand::random::<u64>() % (1 << 53);
|
||||||
|
|
||||||
server
|
server
|
||||||
@@ -177,10 +183,21 @@ pub async fn read_loop(
|
|||||||
|
|
||||||
send_socket(
|
send_socket(
|
||||||
&mut *socket.lock().await,
|
&mut *socket.lock().await,
|
||||||
&ClientMethod::JoinVoice { channel_id, pin },
|
&ClientMethod::JoinVoice {
|
||||||
|
channel_id: channel_id.clone(),
|
||||||
|
pin,
|
||||||
|
},
|
||||||
)
|
)
|
||||||
.await?;
|
.await?;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
server
|
||||||
|
.broadcast(&ClientMethod::UserJoinedVoice {
|
||||||
|
channel_id,
|
||||||
|
pubkey: crate::crypto::to_string(&verifying_key),
|
||||||
|
})
|
||||||
|
.await?;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
socket_lock = socket.lock().await;
|
socket_lock = socket.lock().await;
|
||||||
|
|||||||
+2
-2
@@ -105,7 +105,7 @@ impl Server {
|
|||||||
|
|
||||||
let now = Instant::now();
|
let now = Instant::now();
|
||||||
|
|
||||||
if now.duration_since(voice.last_speaking_sent).as_millis() >= 1000 {
|
if now.duration_since(voice.last_speaking_sent).as_millis() >= 600 {
|
||||||
for conn in user.connections.lock().await.values() {
|
for conn in user.connections.lock().await.values() {
|
||||||
let _ = send_socket(
|
let _ = send_socket(
|
||||||
&mut *conn.lock().await,
|
&mut *conn.lock().await,
|
||||||
@@ -115,9 +115,9 @@ impl Server {
|
|||||||
)
|
)
|
||||||
.await;
|
.await;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
voice.last_speaking_sent = now;
|
voice.last_speaking_sent = now;
|
||||||
|
}
|
||||||
|
|
||||||
let _ = self.udp_send_to(&voice.addr, payload).await;
|
let _ = self.udp_send_to(&voice.addr, payload).await;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user