mirror of
https://github.com/redstrate/Kawari.git
synced 2025-04-28 01:17:45 +00:00
Document the various LobbyConnection functions, move it up to it's super module
This commit is contained in:
parent
dae20a1e0c
commit
8859683074
3 changed files with 11 additions and 3 deletions
|
@ -1,5 +1,5 @@
|
||||||
|
use kawari::lobby::LobbyConnection;
|
||||||
use kawari::lobby::chara_make::CharaMake;
|
use kawari::lobby::chara_make::CharaMake;
|
||||||
use kawari::lobby::connection::LobbyConnection;
|
|
||||||
use kawari::lobby::ipc::{
|
use kawari::lobby::ipc::{
|
||||||
CharacterDetails, ClientLobbyIpcData, LobbyCharacterActionKind, ServerLobbyIpcData,
|
CharacterDetails, ClientLobbyIpcData, LobbyCharacterActionKind, ServerLobbyIpcData,
|
||||||
ServerLobbyIpcSegment, ServerLobbyIpcType,
|
ServerLobbyIpcSegment, ServerLobbyIpcType,
|
||||||
|
|
|
@ -22,7 +22,7 @@ use super::{
|
||||||
};
|
};
|
||||||
use crate::lobby::ipc::ClientLobbyIpcSegment;
|
use crate::lobby::ipc::ClientLobbyIpcSegment;
|
||||||
|
|
||||||
/// Represents a single connection between an instance of the client and the lobby server
|
/// Represents a single connection between an instance of the client and the lobby server.
|
||||||
pub struct LobbyConnection {
|
pub struct LobbyConnection {
|
||||||
pub socket: TcpStream,
|
pub socket: TcpStream,
|
||||||
|
|
||||||
|
@ -49,6 +49,7 @@ impl LobbyConnection {
|
||||||
.await;
|
.await;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Send an acknowledgement to the client that we generated a valid encryption key.
|
||||||
pub async fn initialize_encryption(&mut self, phrase: &str, key: &[u8; 4]) {
|
pub async fn initialize_encryption(&mut self, phrase: &str, key: &[u8; 4]) {
|
||||||
// Generate an encryption key for this client
|
// Generate an encryption key for this client
|
||||||
self.state.client_key = Some(generate_encryption_key(key, phrase));
|
self.state.client_key = Some(generate_encryption_key(key, phrase));
|
||||||
|
@ -67,6 +68,7 @@ impl LobbyConnection {
|
||||||
.await;
|
.await;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Send the service account list to the client.
|
||||||
pub async fn send_account_list(&mut self) {
|
pub async fn send_account_list(&mut self) {
|
||||||
// send the client the service account list
|
// send the client the service account list
|
||||||
let service_accounts = [ServiceAccount {
|
let service_accounts = [ServiceAccount {
|
||||||
|
@ -103,6 +105,7 @@ impl LobbyConnection {
|
||||||
.await;
|
.await;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Send the world, retainer and character list to the client.
|
||||||
pub async fn send_lobby_info(&mut self, sequence: u64) {
|
pub async fn send_lobby_info(&mut self, sequence: u64) {
|
||||||
let mut packets = Vec::new();
|
let mut packets = Vec::new();
|
||||||
// send them the server list
|
// send them the server list
|
||||||
|
@ -289,6 +292,7 @@ impl LobbyConnection {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Send the host information for the world server to the client.
|
||||||
pub async fn send_enter_world(&mut self, sequence: u64, lookup_id: u64) {
|
pub async fn send_enter_world(&mut self, sequence: u64, lookup_id: u64) {
|
||||||
let Some(session_id) = &self.session_id else {
|
let Some(session_id) = &self.session_id else {
|
||||||
panic!("Missing session id!");
|
panic!("Missing session id!");
|
||||||
|
@ -320,6 +324,7 @@ impl LobbyConnection {
|
||||||
.await;
|
.await;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Send a lobby error to the client.
|
||||||
pub async fn send_error(&mut self, sequence: u64, error: u32, exd_error: u16) {
|
pub async fn send_error(&mut self, sequence: u64, error: u32, exd_error: u16) {
|
||||||
let lobby_error = ServerLobbyIpcData::LobbyError {
|
let lobby_error = ServerLobbyIpcData::LobbyError {
|
||||||
sequence,
|
sequence,
|
||||||
|
|
|
@ -1,4 +1,7 @@
|
||||||
pub mod chara_make;
|
pub mod chara_make;
|
||||||
mod client_select_data;
|
mod client_select_data;
|
||||||
pub mod connection;
|
|
||||||
|
mod connection;
|
||||||
|
pub use connection::LobbyConnection;
|
||||||
|
|
||||||
pub mod ipc;
|
pub mod ipc;
|
||||||
|
|
Loading…
Add table
Reference in a new issue