server: deduplicate rwhod entries by hostname, misc cleanup
Build and test / check (push) Successful in 1m5s
Build and test / test (push) Successful in 1m47s
Build and test / build (push) Successful in 1m59s
Build and test / docs (push) Successful in 3m18s

This commit is contained in:
2026-01-09 04:58:20 +09:00
parent dfa0f5a406
commit 6c3a9e9e12
3 changed files with 73 additions and 59 deletions
+7 -10
View File
@@ -1,6 +1,5 @@
use std::{
collections::HashMap,
net::IpAddr,
os::fd::{AsRawFd, FromRawFd, OwnedFd},
path::PathBuf,
sync::Arc,
@@ -8,16 +7,14 @@ use std::{
use anyhow::Context;
use clap::Parser;
use roowho2_lib::{
proto::WhodStatusUpdate,
server::{
rwhod::{rwhod_packet_receiver_task, rwhod_packet_sender_task},
varlink_api::varlink_client_server_task,
},
};
use tokio::{net::UdpSocket, sync::RwLock};
use tracing_subscriber::{EnvFilter, fmt, layer::SubscriberExt, util::SubscriberInitExt};
use roowho2_lib::server::{
rwhod::{RwhodStatusStore, rwhod_packet_receiver_task, rwhod_packet_sender_task},
varlink_api::varlink_client_server_task,
};
#[derive(Parser)]
#[command(
author = "Programvareverkstedet <projects@pvv.ntnu.no>",
@@ -106,7 +103,7 @@ async fn ctrl_c_handler() -> anyhow::Result<()> {
async fn rwhod_server(
socket: UdpSocket,
whod_status_store: Arc<RwLock<HashMap<IpAddr, WhodStatusUpdate>>>,
whod_status_store: RwhodStatusStore,
) -> anyhow::Result<()> {
let socket = Arc::new(socket);
@@ -125,7 +122,7 @@ async fn rwhod_server(
async fn client_server(
socket_fd: OwnedFd,
whod_status_store: Arc<RwLock<HashMap<IpAddr, WhodStatusUpdate>>>,
whod_status_store: RwhodStatusStore,
) -> anyhow::Result<()> {
// SAFETY: see above
let std_socket =