addtions to REGISTER request

This commit is contained in:
2025-07-26 15:03:53 +02:00
parent 2e08a3093e
commit 3bcccc7620
8 changed files with 557 additions and 102 deletions
+19 -3
View File
@@ -1,6 +1,13 @@
mod net;
use std::{net::UdpSocket, process::exit, sync::Arc};
mod types;
mod utils;
use std::{
net::UdpSocket,
process::exit,
sync::{Arc, RwLock},
};
use orx_concurrent_vec::ConcurrentVec;
fn main() -> std::io::Result<()> {
{
let socket: Arc<UdpSocket> = Arc::new(
@@ -14,13 +21,22 @@ fn main() -> std::io::Result<()> {
.expect("Failed to bind to any available port"),
);
let registration_vector: Arc<ConcurrentVec<types::Registration>> =
Arc::new(orx_concurrent_vec::ConcurrentVec::new());
let mut buf: [u8; pea_2_pea::BUFFER_SIZE] = [0; pea_2_pea::BUFFER_SIZE];
smol::block_on(async {
loop {
match socket.recv_from(&mut buf) {
Ok((data_length, src)) => {
smol::spawn(net::handle_request(buf, socket.clone(), src, data_length))
.detach();
smol::spawn(net::handle_request(
buf,
socket.clone(),
src,
data_length,
registration_vector.clone(),
))
.detach();
}
Err(e) => {
eprintln!("Error receiving data: {}", e);