gameServer2/src/server/network.rs
changeset 14413 e335b3120f59
parent 14395 e5db279308d7
equal deleted inserted replaced
14412:42776184fc39 14413:e335b3120f59
    18 use crate::{
    18 use crate::{
    19     utils,
    19     utils,
    20     protocol::{ProtocolDecoder, messages::*}
    20     protocol::{ProtocolDecoder, messages::*}
    21 };
    21 };
    22 use super::{
    22 use super::{
       
    23     io::FileServerIO,
    23     core::{HWServer},
    24     core::{HWServer},
    24     coretypes::ClientId
    25     coretypes::ClientId
    25 };
    26 };
    26 #[cfg(feature = "tls-connections")]
    27 #[cfg(feature = "tls-connections")]
    27 use openssl::{
    28 use openssl::{
   234     ssl: ServerSsl
   235     ssl: ServerSsl
   235 }
   236 }
   236 
   237 
   237 impl NetworkLayer {
   238 impl NetworkLayer {
   238     pub fn new(listener: TcpListener, clients_limit: usize, rooms_limit: usize) -> NetworkLayer {
   239     pub fn new(listener: TcpListener, clients_limit: usize, rooms_limit: usize) -> NetworkLayer {
   239         let server = HWServer::new(clients_limit, rooms_limit);
   240         let server = HWServer::new(clients_limit, rooms_limit, Box::new(FileServerIO::new()));
   240         let clients = Slab::with_capacity(clients_limit);
   241         let clients = Slab::with_capacity(clients_limit);
   241         let pending = HashSet::with_capacity(2 * clients_limit);
   242         let pending = HashSet::with_capacity(2 * clients_limit);
   242         let pending_cache = Vec::with_capacity(2 * clients_limit);
   243         let pending_cache = Vec::with_capacity(2 * clients_limit);
   243 
   244 
   244         NetworkLayer {
   245         NetworkLayer {