mirror of
https://github.com/lubosz/overte.git
synced 2025-04-24 00:13:53 +02:00
more packet version refactoring
This commit is contained in:
parent
b482f479b6
commit
aaaba9c42e
2 changed files with 9 additions and 2 deletions
|
@ -2891,7 +2891,7 @@ void* Application::networkReceive(void* args) {
|
|||
app->_packetCount++;
|
||||
app->_bytesCount += bytesReceived;
|
||||
|
||||
if (app->_incomingPacket[1] == versionForPacketType(app->_incomingPacket[0])) {
|
||||
if (packetVersionMatch(app->_incomingPacket)) {
|
||||
// only process this packet if we have a match on the packet version
|
||||
switch (app->_incomingPacket[0]) {
|
||||
case PACKET_TYPE_TRANSMITTER_DATA_V2:
|
||||
|
|
|
@ -6,6 +6,8 @@
|
|||
// Copyright (c) 2013 HighFidelity, Inc. All rights reserved.
|
||||
//
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include "PacketHeaders.h"
|
||||
|
||||
PACKET_VERSION versionForPacketType(PACKET_TYPE type) {
|
||||
|
@ -19,7 +21,12 @@ PACKET_VERSION versionForPacketType(PACKET_TYPE type) {
|
|||
bool packetVersionMatch(unsigned char* packetHeader) {
|
||||
// currently this just checks if the version in the packet matches our return from versionForPacketType
|
||||
// may need to be expanded in the future for types and versions that take > than 1 byte
|
||||
return packetHeader[1] == versionForPacketType(packetHeader[0]);
|
||||
if (packetHeader[1] == versionForPacketType(packetHeader[0])) {
|
||||
return true;
|
||||
} else {
|
||||
printf("There is a packet version mismatch for packet with header %c\n", packetHeader[0]);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
int populateTypeAndVersion(unsigned char* destinationHeader, PACKET_TYPE type) {
|
||||
|
|
Loading…
Reference in a new issue