Browse Source

more warnings

pbs
jake 5 years ago
parent
commit
4c4a839827
  1. 9
      src/common/client.rs
  2. 14
      src/common/clientpool.rs
  3. 5
      src/common/mainloop.rs
  4. 2
      src/login/main.rs

9
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<S, R> {
pub id: ClientId,

14
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<S, R>(sender: &Sender<ClientPoolAction<R>>, client: &mut Client<S, R>) -> Result<(), PacketNetworkError> where
S: SendServerPacket + std::fmt::Debug,

5
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<STATE, S, R, E>(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();

2
src/login/main.rs

@ -1,5 +1,3 @@
#![feature(const_generics)]
mod login;
mod character;
mod dataaccess;

Loading…
Cancel
Save