use packet;
use packet::{ Packet, ReadingResult, PacketType };
use packet::PacketType::{ Command, Answer, Error };
+use utils::from_elem;
// Default timeout when waiting data on a stream (for instance: 'TcpStream::read').
static DEFAULT_TIMEOUT: Option<u64> = Some(500); // [ms].
// 5)
|client: &mut Client| -> bool {
println!("Sending a packet with too small data...");
- let command = Command(Packet::new_packet_data(0, Vec::from_elem(6, 0x00)));
+ let command = Command(Packet::new_packet_data(0, from_elem(6, 0x00)));
match client.end_point.send_with_result(command) {
Ok(Err(packet::ReadingError::IO( IoError { kind: io::TimedOut, .. }))) => true, // OK: the server should not send any packet.
other => {
// 6)
|client: &mut Client| -> bool {
println!("Sending a packet with too large data...");
- let command = Command(Packet::new_packet_data(0, Vec::from_elem(40, 0x00)));
+ let command = Command(Packet::new_packet_data(0, from_elem(40, 0x00)));
match client.end_point.send_with_result(command) {
Ok(Err(packet::ReadingError::IO( IoError { kind: io::TimedOut, .. }))) => true, // OK: the server should not send any packet.
other => {