mirror of
https://github.com/overte-org/overte.git
synced 2025-04-15 00:28:43 +02:00
type squish and magic number removal
This commit is contained in:
parent
6804ab8a33
commit
544f9c2e7a
1 changed files with 5 additions and 3 deletions
|
@ -89,8 +89,8 @@ void NodeList::timePingReply(sockaddr *nodeAddress, unsigned char *packetData) {
|
|||
}
|
||||
}
|
||||
|
||||
void NodeList::processNodeData(sockaddr *senderAddress, unsigned char *packetData, size_t dataBytes) {
|
||||
switch (((char *)packetData)[0]) {
|
||||
void NodeList::processNodeData(sockaddr* senderAddress, unsigned char* packetData, size_t dataBytes) {
|
||||
switch (packetData[0]) {
|
||||
case PACKET_TYPE_DOMAIN: {
|
||||
processDomainServerList(packetData, dataBytes);
|
||||
break;
|
||||
|
@ -238,13 +238,15 @@ void NodeList::sendDomainServerCheckIn() {
|
|||
// construct the DS check in packet if we need to
|
||||
static unsigned char* checkInPacket = NULL;
|
||||
static int checkInPacketSize;
|
||||
|
||||
const int IP_ADDRESS_BYTES = 4;
|
||||
|
||||
if (!checkInPacket) {
|
||||
int numBytesNodesOfInterest = _nodeTypesOfInterest ? strlen((char*) _nodeTypesOfInterest) : 0;
|
||||
|
||||
// check in packet has header, node type, port, IP, node types of interest, null termination
|
||||
int numPacketBytes = sizeof(PACKET_TYPE) + sizeof(PACKET_VERSION) + sizeof(NODE_TYPE) + sizeof(uint16_t) +
|
||||
(sizeof(char) * 4) + numBytesNodesOfInterest + sizeof(unsigned char);
|
||||
IP_ADDRESS_BYTES + numBytesNodesOfInterest + sizeof(unsigned char);
|
||||
|
||||
checkInPacket = new unsigned char[numPacketBytes];
|
||||
unsigned char* packetPosition = checkInPacket;
|
||||
|
|
Loading…
Reference in a new issue