1- use std:: collections:: HashMap ;
2- use std:: thread;
3- use std:: time:: { Duration , Instant , SystemTime , UNIX_EPOCH , SystemTimeError } ;
4-
51mod version;
62
73mod protocol;
@@ -12,13 +8,13 @@ pub mod timer;
128
139mod key;
1410
15- use crate :: data_access_layer:: Cache ;
16- use crate :: entities:: { CommandPacket , Exception , StatePacket } ;
17- use self :: id:: { Filter , Generator , Arranger } ;
18- use self :: version:: VersionChecker ;
11+ use self :: id:: { Arranger , Filter , Generator } ;
12+ use self :: key as k;
1913use self :: protocol:: ProtocolChecker ;
2014use self :: timer:: SleepTimer ;
21- use self :: key as k;
15+ use self :: version:: VersionChecker ;
16+ use crate :: data_access_layer:: Cache ;
17+ use crate :: entities:: { CommandPacket , Exception , StatePacket } ;
2218
2319pub struct Client {
2420 protocol_version : VersionChecker ,
@@ -48,8 +44,8 @@ impl Client {
4844
4945 fn create_command ( & mut self , command : Vec < u8 > ) -> CommandPacket {
5046 CommandPacket {
51- protocol_id : self . protocol_id . get ( ) ,
52- protocol_version : self . protocol_version . get ( ) ,
47+ protocol_id : self . protocol_id . get ( ) ,
48+ protocol_version : self . protocol_version . get ( ) ,
5349 id : self . id . generate ( ) ,
5450 command,
5551 session_key : self . key_generator . generate ( ) ,
@@ -70,7 +66,7 @@ impl Client {
7066 self . key_filter = k:: Filter :: new ( state. session_key ) ;
7167 self . id_filter = Filter :: new ( 0 ) ;
7268 }
73- self . id_filter . is_valid_last_recv_id ( & state) ?;
69+ self . id_filter . filter ( & state) ?;
7470 let vec = self . cache . get_range ( & state. lost_ids ) ;
7571 Ok ( ( state. state , vec) )
7672 }
@@ -98,7 +94,6 @@ impl Server {
9894 }
9995 }
10096
101-
10297 pub fn send ( & mut self , state : Vec < u8 > ) -> StatePacket {
10398 StatePacket {
10499 protocol_id : self . protocol_id . get ( ) ,
0 commit comments