Packet id tracing

This commit is contained in:
arkpar 2016-10-27 16:20:11 +02:00
parent 123b75179c
commit 6978042c16

View File

@ -395,7 +395,7 @@ impl Session {
PACKET_PEERS => Ok(SessionData::None), PACKET_PEERS => Ok(SessionData::None),
PACKET_USER ... PACKET_LAST => { PACKET_USER ... PACKET_LAST => {
let mut i = 0usize; let mut i = 0usize;
while packet_id > self.info.capabilities[i].id_offset + self.info.capabilities[i].packet_count { while packet_id >= self.info.capabilities[i].id_offset + self.info.capabilities[i].packet_count {
i += 1; i += 1;
if i == self.info.capabilities.len() { if i == self.info.capabilities.len() {
debug!(target: "network", "Unknown packet: {:?}", packet_id); debug!(target: "network", "Unknown packet: {:?}", packet_id);
@ -406,6 +406,7 @@ impl Session {
// map to protocol // map to protocol
let protocol = self.info.capabilities[i].protocol; let protocol = self.info.capabilities[i].protocol;
let pid = packet_id - self.info.capabilities[i].id_offset; let pid = packet_id - self.info.capabilities[i].id_offset;
trace!(target: "network", "Packet {} mapped to {:?}:{}, i={}, capabilities={:?}", packet_id, protocol, pid, i, self.info.capabilities);
Ok(SessionData::Packet { data: packet.data, protocol: protocol, packet_id: pid } ) Ok(SessionData::Packet { data: packet.data, protocol: protocol, packet_id: pid } )
}, },
_ => { _ => {