- Drop dead Rooms/Room infrastructure and the rooms field on Context. - Remove unused ActorMessage::Tick variant and the now-empty handler arm. - Strip dead active-thread tracking machinery from ThreadPool (unused getters, _id/_active_threads/_total_threads parameters). - Flatten ServerActor::initiate_connection: the duplicated retry block was a copy-paste retry against the same address with the same args and could never succeed where the first attempt failed. - Delete commented-out print_hex2/decode debug stubs, dead test fixtures in login.rs and message_user.rs, the 47-line commented body of RoomListHandler, and assorted // TODO theater.
32 lines
883 B
Rust
32 lines
883 B
Rust
use crate::actor::server_actor::{ServerMessage, UserMessage};
|
|
use crate::info;
|
|
use crate::message::{Message, MessageHandler};
|
|
|
|
use std::sync::mpsc::Sender;
|
|
|
|
pub struct MessageUser;
|
|
|
|
impl MessageHandler<ServerMessage> for MessageUser {
|
|
fn get_code(&self) -> u8 {
|
|
22
|
|
}
|
|
|
|
fn handle(&self, message: &mut Message, _sender: Sender<ServerMessage>) {
|
|
let id = message.read_int32();
|
|
let timestamp = message.read_int32();
|
|
let username = message.read_string();
|
|
let message_content = message.read_string();
|
|
let new_message = message.read_bool();
|
|
let user_message = UserMessage::new(
|
|
id,
|
|
timestamp,
|
|
username.clone(),
|
|
message_content,
|
|
new_message,
|
|
);
|
|
|
|
info!("[MessageUser] User message received:{:?}", user_message);
|
|
user_message.print()
|
|
}
|
|
}
|