1
0
mirror of https://git.ngram.ca/OpenJam/rc-servers synced 2026-08-23 23:08:52 +00:00

Add server for game data (implement login sequence)

This commit is contained in:
NGnius (Graham)
2025-02-12 18:46:27 -05:00
parent ca4a0ce675
commit d8885d811f
52 changed files with 2734 additions and 5 deletions

View File

@@ -24,10 +24,17 @@ async fn main() -> std::io::Result<()> {
let listener = net::TcpListener::bind(std::net::SocketAddr::new(ip_addr, args.port)).await?;
#[cfg(not(debug_assertions))]
loop {
let (socket, address) = listener.accept().await?;
tokio::spawn(process_socket(socket, address, NonZero::new(args.retries), redirect_static, room_name_static));
}
#[cfg(debug_assertions)]
{
let (socket, address) = listener.accept().await?;
process_socket(socket, address, NonZero::new(args.retries), redirect_static, room_name_static).await;
Ok(())
}
}
async fn process_socket(mut socket: net::TcpStream, address: std::net::SocketAddr, retries: Option<NonZero<usize>>, game_server_url: &str, game_server_name: &str) {
@@ -50,6 +57,7 @@ async fn process_socket(mut socket: net::TcpStream, address: std::net::SocketAdd
Packet::Packet(packet) => log::warn!("Not handling packet {:?}", packet),
}
}
log::debug!("Goodbye connection from address {}", address);
}
async fn handle_ping(ping: Ping, buf: &mut Vec<u8>, socket: &mut net::TcpStream) {