remove rpc, cli start

This commit is contained in:
2026-06-04 12:37:57 +02:00
parent 3ce0f800a0
commit 37ce941e02
15 changed files with 219 additions and 126 deletions

View File

@ -4,4 +4,4 @@ mod client;
mod socket;
pub use socket::process_mc_socket;
pub use socket::mc_socket_listen;

View File

@ -3,7 +3,25 @@ use tokio::net::TcpStream;
use crate::DbPool;
pub async fn process_mc_socket(stream: TcpStream, pool: DbPool) -> Result<(), String> {
use tokio::net::TcpListener;
use std::io;
pub async fn mc_socket_listen(pool: DbPool) -> io::Result<()> {
let mc_listener = TcpListener::bind("0.0.0.0:25565").await?;
loop {
if let Ok((socket, _)) = mc_listener.accept().await {
let cloned = pool.clone();
tokio::spawn(async move {
if let Err(e) = process_mc_socket(socket, cloned).await {
eprintln!("mc error: {:?}", e);
}
});
}
}
}
async fn process_mc_socket(stream: TcpStream, pool: DbPool) -> Result<(), String> {
println!("new client {:?}", stream);
let mut client = Client::create(stream, pool);