diff --git a/src/common/client.rs b/src/common/client.rs index 12f2c8c..d7cf93a 100644 --- a/src/common/client.rs +++ b/src/common/client.rs @@ -1,14 +1,9 @@ use libpso::crypto::{PSOCipher, NullCipher}; -use libpso::{PSOPacket, PacketParseError}; -use crate::common::serverstate::{ServerState, SendServerPacket, RecvServerPacket, OnConnect, ClientId}; -use crate::common::network::{recv_packet, PacketNetworkError}; +use crate::common::serverstate::{SendServerPacket, RecvServerPacket, ClientId}; +use crate::common::network::PacketNetworkError; -use std::net; use std::io::{Read, Write}; -use mio::tcp::TcpStream; -use mio::{Poll, Events, Token, Ready, PollOpt}; -use mio_extras::channel::Sender; pub struct Client { pub id: ClientId, diff --git a/src/common/clientpool.rs b/src/common/clientpool.rs index 2f513d5..93c06f9 100644 --- a/src/common/clientpool.rs +++ b/src/common/clientpool.rs @@ -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(sender: &Sender>, client: &mut Client) -> Result<(), PacketNetworkError> where S: SendServerPacket + std::fmt::Debug, diff --git a/src/common/mainloop.rs b/src/common/mainloop.rs index 341a66f..2b45ebc 100644 --- a/src/common/mainloop.rs +++ b/src/common/mainloop.rs @@ -1,10 +1,9 @@ use std::thread; use mio::{Events, Poll, Token, Ready, PollOpt}; -use mio::tcp::TcpStream; use mio_extras::channel::{channel, Sender, Receiver}; use crate::common::clientpool::{ClientPool, ClientAction, ClientPoolAction}; -use crate::common::serverstate::{RecvServerPacket, SendServerPacket, ServerState, OnConnect, ClientId}; +use crate::common::serverstate::{RecvServerPacket, SendServerPacket, ServerState, OnConnect}; @@ -74,7 +73,7 @@ pub fn mainloop(mut state: STATE, port: u16) where clientpool.io_loop(); }); - let handler_threadpool = threadpool::ThreadPool::new(4); + //let handler_threadpool = threadpool::ThreadPool::new(4); let handler_thread = thread::spawn(move || { let poll = Poll::new().unwrap(); poll.register(&handler_recv, Token(0), Ready::readable(), PollOpt::edge()).unwrap(); diff --git a/src/login/main.rs b/src/login/main.rs index 654ceed..1f1c890 100644 --- a/src/login/main.rs +++ b/src/login/main.rs @@ -1,5 +1,3 @@ -#![feature(const_generics)] - mod login; mod character; mod dataaccess;