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:
@@ -1,12 +1,17 @@
|
||||
use std::collections::HashMap;
|
||||
use std::sync::Arc;
|
||||
use std::fmt;
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
use crate::handlers::chat_client::ChatClientHandler;
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct ConnectionState {
|
||||
pub user_id: Option<String>,
|
||||
pub session_id: Option<String>,
|
||||
pub character_id: Option<i8>,
|
||||
pub character_list: Option<Vec<u32>>,
|
||||
pub additional_data: HashMap<String, String>, // Flexible data storage
|
||||
pub chat_handler: Option<Arc<ChatClientHandler>>,
|
||||
}
|
||||
|
||||
impl ConnectionState {
|
||||
@@ -17,6 +22,20 @@ impl ConnectionState {
|
||||
character_id: None,
|
||||
character_list: None,
|
||||
additional_data: HashMap::new(),
|
||||
chat_handler: None,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl fmt::Debug for ConnectionState {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
f.debug_struct("ConnectionState")
|
||||
.field("user_id", &self.user_id)
|
||||
.field("session_id", &self.session_id)
|
||||
.field("character_id", &self.character_id)
|
||||
.field("character_list", &self.character_list)
|
||||
.field("additional_data", &self.additional_data)
|
||||
.field("chat_handler", &self.chat_handler.as_ref().map(|_| "<chat handler>"))
|
||||
.finish()
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user