From b57a78c414f76d6c877e362b66645a2696bedceb Mon Sep 17 00:00:00 2001 From: Andrzej Kapolka Date: Thu, 13 Jun 2013 13:15:08 -0700 Subject: [PATCH] Another fix: using strlen to determine the length of the packet is... unwise. Remember the length when we create it. This should fix the voxel server's not appearing. --- libraries/shared/src/AgentList.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/libraries/shared/src/AgentList.cpp b/libraries/shared/src/AgentList.cpp index e1b4bd9d63..7a4803586e 100644 --- a/libraries/shared/src/AgentList.cpp +++ b/libraries/shared/src/AgentList.cpp @@ -205,6 +205,7 @@ void AgentList::sendDomainServerCheckIn() { // construct the DS check in packet if we need to static unsigned char* checkInPacket = NULL; + static int checkInPacketSize; if (!checkInPacket) { int numBytesAgentsOfInterest = _agentTypesOfInterest ? strlen((char*) _agentTypesOfInterest) : 0; @@ -236,10 +237,10 @@ void AgentList::sendDomainServerCheckIn() { packetPosition += numBytesAgentsOfInterest; } - *packetPosition = '\0'; + checkInPacketSize = packetPosition - checkInPacket; } - _agentSocket.send(DOMAIN_IP, DOMAINSERVER_PORT, checkInPacket, strlen((char*) checkInPacket)); + _agentSocket.send(DOMAIN_IP, DOMAINSERVER_PORT, checkInPacket, checkInPacketSize); } int AgentList::processDomainServerList(unsigned char *packetData, size_t dataBytes) {