|
|
@ -1,25 +1,23 @@ |
|
|
|
use std::thread;
|
|
|
|
//use std::thread;
|
|
|
|
use std::collections::HashMap;
|
|
|
|
|
|
|
|
use std::net::{SocketAddr, Ipv4Addr};
|
|
|
|
|
|
|
|
use std::sync::mpsc::TryRecvError;
|
|
|
|
use mio::tcp::{TcpStream, TcpListener};
|
|
|
|
use mio::tcp::TcpListener;
|
|
|
|
use mio::{Events, Poll, Token, Ready, PollOpt};
|
|
|
|
|
|
|
|
use crate::common::client::Client;
|
|
|
|
use crate::common::serverstate::{ServerState, SendServerPacket, RecvServerPacket, OnConnect, ClientId};
|
|
|
|
//use std::sync::mpsc;
|
|
|
|
//use mio::channel as mpsc;
|
|
|
|
use crate::common::serverstate::{SendServerPacket, RecvServerPacket, ClientId};
|
|
|
|
use libpso::crypto::PSOCipher;
|
|
|
|
|
|
|
|
use mio_extras::channel::{channel, Sender, Receiver};
|
|
|
|
use mio_extras::channel::{Sender, Receiver};
|
|
|
|
|
|
|
|
use crate::common::network::PacketNetworkError;
|
|
|
|
|
|
|
|
use threadpool::ThreadPool;
|
|
|
|
//use threadpool::ThreadPool;
|
|
|
|
|
|
|
|
const THREAD_COUNT: usize = 4;
|
|
|
|
//const THREAD_COUNT: usize = 4;
|
|
|
|
|
|
|
|
fn client_read<S, R>(sender: &Sender<ClientPoolAction<R>>, client: &mut Client<S, R>) -> Result<(), PacketNetworkError> where
|
|
|
|
S: SendServerPacket + std::fmt::Debug,
|
|
|
|