More work.

Added chat service
Updated packet service to pass the tcp stream around in a Arc type.
Updated character position data to not require multiplying the coords
Added more debug logs
Added an interceptor for gRPC comms with the chat server
Updated build and push script for the chat server changes
This commit is contained in:
2025-06-06 17:52:29 -04:00
parent 85d41c0239
commit ad6ba2c8e6
32 changed files with 787 additions and 92 deletions

View File

@@ -39,18 +39,19 @@ mod packet_type;
mod packets;
mod router;
mod types;
mod interceptors;
pub mod common {
tonic::include_proto!("common");
}
pub mod auth {
tonic::include_proto!("auth"); // Path matches the package name in auth.proto
tonic::include_proto!("auth");
}
pub mod character_common {
tonic::include_proto!("character_common"); // Path matches the package name in auth.proto
tonic::include_proto!("character_common");
}
pub mod character {
tonic::include_proto!("character"); // Path matches the package name in auth.proto
tonic::include_proto!("character");
}
const BUFFER_POOL_SIZE: usize = 1000;
@@ -110,13 +111,14 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
let pool = buffer_pool.clone();
let permit = semaphore.clone().acquire_owned().await.unwrap();
let stream = Arc::new(Mutex::new(socket));
// Spawn a new task for each connection
tokio::spawn(async move {
let _permit = permit;
let connection_id = packet_router.connection_service.add_connection();
if let Err(e) = packet_router
.handle_connection(&mut socket, pool, connection_id.clone())
.handle_connection(stream, pool, connection_id.clone())
.await
{
error!("Error handling connection: {}", e);