1
Fork 0
mirror of https://github.com/redstrate/Kawari.git synced 2025-04-20 14:47:45 +00:00

Add dummy lobby server

This doesn't respond or read anything yet, it's just for testing.
This commit is contained in:
Joshua Goins 2025-03-08 13:51:50 -05:00
parent 40ef6b8193
commit b5afff068a
4 changed files with 33 additions and 3 deletions

3
Cargo.lock generated
View file

@ -1,6 +1,6 @@
# This file is automatically @generated by Cargo. # This file is automatically @generated by Cargo.
# It is not intended for manual editing. # It is not intended for manual editing.
version = 3 version = 4
[[package]] [[package]]
name = "addr2line" name = "addr2line"
@ -654,6 +654,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1adbebffeca75fcfd058afa480fb6c0b81e165a0323f9c9d39c9697e37c46787" checksum = "1adbebffeca75fcfd058afa480fb6c0b81e165a0323f9c9d39c9697e37c46787"
dependencies = [ dependencies = [
"backtrace", "backtrace",
"bytes",
"libc", "libc",
"mio", "mio",
"num_cpus", "num_cpus",

View file

@ -28,7 +28,7 @@ panic = "abort"
[dependencies] [dependencies]
axum = { version = "0.6", features = ["json", "tokio", "http1", "form", "query", "headers"], default-features = false } axum = { version = "0.6", features = ["json", "tokio", "http1", "form", "query", "headers"], default-features = false }
serde_json = { version = "1.0", default-features = false } serde_json = { version = "1.0", default-features = false }
tokio = { version = "1.37", features = ["macros", "rt", "rt-multi-thread"], default-features = false } tokio = { version = "1.37", features = ["macros", "rt", "rt-multi-thread", "io-util"], default-features = false }
tracing = { version = "0.1", default-features = false } tracing = { version = "0.1", default-features = false }
serde = { version = "1.0", features = ["derive"], default-features = false } serde = { version = "1.0", features = ["derive"], default-features = false }
tracing-subscriber = { version = "0.3", features = ["fmt"], default-features = false } tracing-subscriber = { version = "0.3", features = ["fmt"], default-features = false }

3
run.sh
View file

@ -7,4 +7,5 @@ cargo run -q --package kawari --bin kawari-frontier &
cargo run -q --package kawari --bin kawari-login & cargo run -q --package kawari --bin kawari-login &
cargo run -q --package kawari --bin kawari-patch & cargo run -q --package kawari --bin kawari-patch &
cargo run -q --package kawari --bin kawari-web & cargo run -q --package kawari --bin kawari-web &
wait cargo run -q --package kawari --bin kawari-lobby &
wait

28
src/bin/kawari-lobby.rs Normal file
View file

@ -0,0 +1,28 @@
use tokio::io::AsyncReadExt;
use tokio::net::TcpListener;
#[tokio::main]
async fn main() {
tracing_subscriber::fmt::init();
let listener = TcpListener::bind("127.0.0.1:7000").await.unwrap();
tracing::info!("Lobby server started on 7000");
loop {
let (socket, _) = listener.accept().await.unwrap();
let (mut read, _) = tokio::io::split(socket);
tokio::spawn(async move {
let mut buf = [0; 2056];
loop {
let n = read
.read(&mut buf)
.await
.expect("Failed to read data!");
println!("Recieved data: {:#?}", &buf[..n]);
}
});
}
}