| 260 | } |
| 261 | |
| 262 | void Connection::recordPacketStats(const Packet& packet, bool sending) |
| 263 | { |
| 264 | uint32_t packetSize = static_cast<uint32_t>(packet.bytesTransferred); |
| 265 | StatisticsGroup trafficGroup; |
| 266 | |
| 267 | switch (packet.getCommand()) |
| 268 | { |
| 269 | case Command::gameAction: |
| 270 | trafficGroup = StatisticsGroup::commands; |
| 271 | break; |
| 272 | case Command::map: |
| 273 | trafficGroup = StatisticsGroup::mapData; |
| 274 | break; |
| 275 | default: |
| 276 | trafficGroup = StatisticsGroup::base; |
| 277 | break; |
| 278 | } |
| 279 | |
| 280 | if (sending) |
| 281 | { |
| 282 | stats.bytesSent[EnumValue(trafficGroup)] += packetSize; |
| 283 | stats.bytesSent[EnumValue(StatisticsGroup::total)] += packetSize; |
| 284 | } |
| 285 | else |
| 286 | { |
| 287 | stats.bytesReceived[EnumValue(trafficGroup)] += packetSize; |
| 288 | stats.bytesReceived[EnumValue(StatisticsGroup::total)] += packetSize; |
| 289 | } |
| 290 | } |
| 291 | |
| 292 | Command Connection::getPendingPacketCommand() const noexcept |
| 293 | { |
nothing calls this directly
no test coverage detected