rust/hedgewars-server/src/server/network.rs
changeset 15119 9397e07b3086
parent 15096 e935b1ad23f3
child 15123 80ff12edf5e6
equal deleted inserted replaced
15118:260e96addf92 15119:9397e07b3086
    23     protocol::{messages::*, ProtocolDecoder},
    23     protocol::{messages::*, ProtocolDecoder},
    24     utils,
    24     utils,
    25 };
    25 };
    26 
    26 
    27 #[cfg(feature = "official-server")]
    27 #[cfg(feature = "official-server")]
    28 use super::io::{IOThread, RequestId};
    28 use super::io::{IoThread, RequestId};
    29 
    29 
    30 use crate::{
    30 use crate::{
    31     handlers::{IoResult, IoTask},
    31     handlers::{IoResult, IoTask},
    32     protocol::messages::HwServerMessage::Redirect,
    32     protocol::messages::HwServerMessage::Redirect,
    33 };
    33 };
   249 
   249 
   250 #[cfg(feature = "official-server")]
   250 #[cfg(feature = "official-server")]
   251 pub struct IoLayer {
   251 pub struct IoLayer {
   252     next_request_id: RequestId,
   252     next_request_id: RequestId,
   253     request_queue: Vec<(RequestId, ClientId)>,
   253     request_queue: Vec<(RequestId, ClientId)>,
   254     io_thread: IOThread,
   254     io_thread: IoThread,
   255 }
   255 }
   256 
   256 
   257 #[cfg(feature = "official-server")]
   257 #[cfg(feature = "official-server")]
   258 impl IoLayer {
   258 impl IoLayer {
   259     fn new() -> Self {
   259     fn new() -> Self {
   260         Self {
   260         Self {
   261             next_request_id: 0,
   261             next_request_id: 0,
   262             request_queue: vec![],
   262             request_queue: vec![],
   263             io_thread: IOThread::new(),
   263             io_thread: IoThread::new(),
   264         }
   264         }
   265     }
   265     }
   266 
   266 
   267     fn send(&mut self, client_id: ClientId, task: IoTask) {
   267     fn send(&mut self, client_id: ClientId, task: IoTask) {
   268         let request_id = self.next_request_id;
   268         let request_id = self.next_request_id;