Update handshake.rs
This commit is contained in:
parent
b2dd6ded1d
commit
213bfc4417
@ -282,12 +282,12 @@ impl Handshake {
|
|||||||
}
|
}
|
||||||
Err(_) => {
|
Err(_) => {
|
||||||
// Try to interpret as EIP-8 packet
|
// Try to interpret as EIP-8 packet
|
||||||
let size = ((data[0] as u16) << 8 | (data[1] as u16)) as usize;
|
let total = (((data[0] as u16) << 8 | (data[1] as u16)) as usize) + 2;
|
||||||
if size < (V4_ACK_PACKET_SIZE - 2) {
|
if total < V4_ACK_PACKET_SIZE {
|
||||||
debug!(target:"net", "Wrong EIP8 ack packet size");
|
debug!(target: "net", "Wrong EIP8 ack packet size");
|
||||||
return Err(From::from(NetworkError::BadProtocol));
|
return Err(From::from(NetworkError::BadProtocol));
|
||||||
}
|
}
|
||||||
let rest = size - data.len() + 2;
|
let rest = total - data.len();
|
||||||
self.state = HandshakeState::ReadingAckEip8;
|
self.state = HandshakeState::ReadingAckEip8;
|
||||||
self.connection.expect(rest);
|
self.connection.expect(rest);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user