forge
Explore
Log in

Don't you dare go Hollow

yumush

Clone
★ 0

0 watching0 forksRustAGPL-3.06.8 MiB27ceb05Tahinli8 hours ago399 commits

datagram.rs18 lines, 554 bytesHistoryRawDownload
1use std::sync::Arc;
2
3use quinn::Connection;
4use tracing::warn;
5
6use crate::{hub::Client, network::Shared, publish};
7
8pub(crate) async fn relay_datagrams(connection: Connection, client: Arc<Client>, shared: Shared) {
9 while let Ok(bytes) = connection.read_datagram().await {
10 let broadcasts = shared.services.rooms.relay(&client, &bytes);
11 if broadcasts.is_empty() {
12 continue;
13 }
14 if let Err(error) = publish::job(&shared, async |_| Ok(broadcasts)).await {
15 warn!("relay: {error}");
16 }
17 }
18}