|
@ -23,9 +23,7 @@ fn client_read<S, R>(sender: &Sender<ClientPoolAction<R>>, client: &mut Client<S |
|
|
S: SendServerPacket + std::fmt::Debug,
|
|
|
S: SendServerPacket + std::fmt::Debug,
|
|
|
R: RecvServerPacket + std::fmt::Debug,
|
|
|
R: RecvServerPacket + std::fmt::Debug,
|
|
|
{
|
|
|
{
|
|
|
println!("client read");
|
|
|
|
|
|
let pkts = client.read_pkts();
|
|
|
let pkts = client.read_pkts();
|
|
|
println!("pkts: {:?}", pkts);
|
|
|
|
|
|
|
|
|
|
|
|
for pkt in pkts? {
|
|
|
for pkt in pkts? {
|
|
|
sender.send(ClientPoolAction::Packet(client.id, pkt)).unwrap();
|
|
|
sender.send(ClientPoolAction::Packet(client.id, pkt)).unwrap();
|
|
@ -112,8 +110,6 @@ impl<S, R> ClientPool<S, R> where |
|
|
});
|
|
|
});
|
|
|
}
|
|
|
}
|
|
|
ClientAction::Packet(client_id, pkt) => {
|
|
|
ClientAction::Packet(client_id, pkt) => {
|
|
|
println!("action pkt {:?}", pkt);
|
|
|
|
|
|
println!("clients! {:?} {:?}", client_id, self.clients.get(&client_id).is_some());
|
|
|
|
|
|
self.clients.get_mut(&client_id)
|
|
|
self.clients.get_mut(&client_id)
|
|
|
.map(|client| {
|
|
|
.map(|client| {
|
|
|
client.send_pkt(pkt);
|
|
|
client.send_pkt(pkt);
|
|
@ -122,7 +118,6 @@ impl<S, R> ClientPool<S, R> where |
|
|
}
|
|
|
}
|
|
|
},
|
|
|
},
|
|
|
Err(err) => {
|
|
|
Err(err) => {
|
|
|
println!("err! {:?}", err);
|
|
|
|
|
|
match err {
|
|
|
match err {
|
|
|
TryRecvError::Empty => break,
|
|
|
TryRecvError::Empty => break,
|
|
|
TryRecvError::Disconnected => {
|
|
|
TryRecvError::Disconnected => {
|
|
|