clippy fix
Continuous integration / Check (push) Successful in 27s
Continuous integration / Test Suite (push) Successful in 30s
Continuous integration / Rustfmt (push) Failing after 26s
Continuous integration / Clippy (push) Failing after 28s
Continuous integration / build (push) Successful in 31s
Continuous integration / Check (push) Successful in 27s
Continuous integration / Test Suite (push) Successful in 30s
Continuous integration / Rustfmt (push) Failing after 26s
Continuous integration / Clippy (push) Failing after 28s
Continuous integration / build (push) Successful in 31s
This commit is contained in:
+11
-14
@@ -35,13 +35,13 @@ type State = Arc<RwLock<HashMap<u32, Client>>>;
|
||||
|
||||
fn scrape_all_client_streams_info(clients: &HashMap<u32, Client>) -> Vec<AudioStreamInfo> {
|
||||
let mut all_audio_streams_info: Vec<AudioStreamInfo> = Vec::new();
|
||||
for (_, data) in clients {
|
||||
for data in clients.values() {
|
||||
if let Some(audio_streams_info) = &data.audio_streams {
|
||||
all_audio_streams_info.extend(audio_streams_info.iter().cloned());
|
||||
}
|
||||
}
|
||||
|
||||
return all_audio_streams_info;
|
||||
all_audio_streams_info
|
||||
}
|
||||
|
||||
#[tokio::main]
|
||||
@@ -84,11 +84,10 @@ async fn main() {
|
||||
}
|
||||
|
||||
for (&other_client_id, other_client) in clients.iter() {
|
||||
if other_client_id != client_id {
|
||||
if let Some(destination_udp) = other_client.udp_addr {
|
||||
if other_client_id != client_id
|
||||
&& let Some(destination_udp) = other_client.udp_addr {
|
||||
let _ = udp_socket.send_to(&buf[..len], destination_udp).await;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -136,7 +135,7 @@ async fn main() {
|
||||
},
|
||||
}).expect("failed to serialize TcpRequestData::NewAudioStreamAccepted");
|
||||
|
||||
let _ = framed_tcp_stream.send(Bytes::from(response_json))
|
||||
framed_tcp_stream.send(Bytes::from(response_json))
|
||||
.await
|
||||
.expect("failed to send message");
|
||||
|
||||
@@ -145,9 +144,9 @@ async fn main() {
|
||||
TcpRequestData::NewAudioStream { audio_stream_info } => {
|
||||
if let Some(client) = tcp_state.write().await.get_mut(¤t_client_id) {
|
||||
if let Some(audio_streams) = &mut client.audio_streams {
|
||||
audio_streams.push(audio_stream_info.clone());
|
||||
audio_streams.push(audio_stream_info);
|
||||
} else {
|
||||
client.audio_streams = Some(vec![audio_stream_info.clone()]);
|
||||
client.audio_streams = Some(vec![audio_stream_info]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -163,13 +162,11 @@ async fn main() {
|
||||
let _ = global_event_tx_clone.send(ServerEvent::SendAllOtherStreams(current_client_id));
|
||||
}
|
||||
TcpRequestData::DropAudioStream { audio_stream_id } => {
|
||||
if let Some(client) = tcp_state.write().await.get_mut(¤t_client_id) {
|
||||
if let Some(audio_streams) = &mut client.audio_streams {
|
||||
if let Some(idx) = audio_streams.iter().position(|s| s.stream_id == audio_stream_id) {
|
||||
if let Some(client) = tcp_state.write().await.get_mut(¤t_client_id)
|
||||
&& let Some(audio_streams) = &mut client.audio_streams
|
||||
&& let Some(idx) = audio_streams.iter().position(|s| s.stream_id == audio_stream_id) {
|
||||
audio_streams.remove(idx);
|
||||
}
|
||||
}
|
||||
}
|
||||
let _ = global_event_tx_clone.send(ServerEvent::SendAllOtherStreams(current_client_id));
|
||||
}
|
||||
},
|
||||
@@ -205,7 +202,7 @@ async fn main() {
|
||||
let response_json = serde_json::to_string(&TcpResponse {
|
||||
status: ResponseStatus::Ok,
|
||||
data: shared::TcpResponseData::UserDisconnected {
|
||||
user_id: user_id
|
||||
user_id
|
||||
},
|
||||
}).expect("failed to serialize ServerEvent::UserDisconnected");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user