115 bump_last_ping(); |
115 bump_last_ping(); |
116 } |
116 } |
117 } |
117 } |
118 |
118 |
119 for (Datagram datagram; m_socket.read (datagram);) |
119 for (Datagram datagram; m_socket.read (datagram);) |
120 handle_packet (datagram.data, datagram.from); |
120 handle_packet (datagram); |
121 } |
121 } |
122 |
122 |
123 // ------------------------------------------------------------------------------------------------- |
123 // ------------------------------------------------------------------------------------------------- |
124 // |
124 // |
125 void RCONSession::handle_packet (Bytestream& packet, const IPAddress& from) |
125 void RCONSession::handle_packet (Datagram& datagram) |
126 { |
126 { |
127 if (from != m_address) |
127 if (datagram.from != m_address) |
128 return; |
128 return; |
129 |
129 |
130 try |
130 try |
131 { |
131 { |
|
132 Bytestream& packet = datagram.data; |
|
133 int32_t header = packet.read_long(); |
|
134 int32_t sequenceNumber = (header != 0) ? packet.read_long() : 0; |
|
135 m_interface->print("Recieved packet with header 0x%x and sequence number #%d\n", header, sequenceNumber); |
|
136 |
132 while (packet.bytes_left() > 0) |
137 while (packet.bytes_left() > 0) |
133 { |
138 { |
134 int header = packet.read_byte(); |
139 int header = packet.read_byte(); |
135 |
140 |
136 switch (ServerResponse (header)) |
141 switch (ServerResponse (header)) |