|
@ -174,7 +174,7 @@ impl<DA: DataAccess> ServerState for CharacterServerState<DA> { |
|
|
Box::new(self.char_select(sel).into_iter().map(move |pkt| (id, pkt)))
|
|
|
Box::new(self.char_select(sel).into_iter().map(move |pkt| (id, pkt)))
|
|
|
}
|
|
|
}
|
|
|
RecvCharacterPacket::Checksum(checksum) => {
|
|
|
RecvCharacterPacket::Checksum(checksum) => {
|
|
|
Box::new(self.validate_checksum().into_iter())
|
|
|
|
|
|
|
|
|
Box::new(self.validate_checksum().into_iter().map(move |pkt| (id, pkt)))
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@ -225,14 +225,13 @@ mod test { |
|
|
|
|
|
|
|
|
#[test]
|
|
|
#[test]
|
|
|
fn test_user_checksum() {
|
|
|
fn test_user_checksum() {
|
|
|
struct TestData {}
|
|
|
|
|
|
impl DataAccess for TestData{}
|
|
|
|
|
|
let shared = SharedLoginState::new(TestData {});
|
|
|
|
|
|
let mut server = CharacterServerState::new(shared);
|
|
|
|
|
|
let send = server.handle(&RecvCharacterPacket::Checksum(Checksum {flag: 0})).collect::<Vec<_>>();
|
|
|
|
|
|
|
|
|
struct TestData;
|
|
|
|
|
|
impl DataAccess for TestData {}
|
|
|
|
|
|
let mut server = CharacterServerState::new(TestData {});
|
|
|
|
|
|
let send = server.handle(1, &RecvCharacterPacket::Checksum(Checksum {flag: 0})).collect::<Vec<_>>();
|
|
|
assert!(send.len() == 1);
|
|
|
assert!(send.len() == 1);
|
|
|
|
|
|
|
|
|
let bytes = send[0].as_bytes();
|
|
|
|
|
|
|
|
|
let bytes = send[0].1.as_bytes();
|
|
|
assert!(bytes == [0xC, 0, 0xE8, 0x02, 0,0,0,0, 1,0,0,0]);
|
|
|
assert!(bytes == [0xC, 0, 0xE8, 0x02, 0,0,0,0, 1,0,0,0]);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|