mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-04-10 10:34:56 +02:00
fix bug with sent and received agent interest packets
This commit is contained in:
parent
ed79a9f72a
commit
7fb42dcb8a
3 changed files with 16 additions and 8 deletions
|
@ -102,7 +102,8 @@ int main(int argc, const char * argv[])
|
|||
std::map<char, Agent *> newestSoloAgents;
|
||||
|
||||
agentType = packetData[1];
|
||||
int numBytesSocket = unpackSocket(packetData + 2, (sockaddr*) &agentLocalAddress);
|
||||
int numBytesSocket = unpackSocket(packetData + sizeof(PACKET_HEADER) + sizeof(AGENT_TYPE),
|
||||
(sockaddr*) &agentLocalAddress);
|
||||
|
||||
// check the agent public address
|
||||
// if it matches our local address we're on the same box
|
||||
|
@ -127,7 +128,8 @@ int main(int argc, const char * argv[])
|
|||
currentBufferPos = broadcastPacket + sizeof(PACKET_HEADER);
|
||||
startPointer = currentBufferPos;
|
||||
|
||||
char* agentTypesOfInterest = (char*) currentBufferPos + sizeof(AGENT_TYPE) + numBytesSocket + sizeof(unsigned char);
|
||||
unsigned char* agentTypesOfInterest = packetData + sizeof(PACKET_HEADER) + sizeof(AGENT_TYPE)
|
||||
+ numBytesSocket + sizeof(unsigned char);
|
||||
int numInterestTypes = *(agentTypesOfInterest - 1);
|
||||
|
||||
if (numInterestTypes > 0) {
|
||||
|
|
|
@ -209,7 +209,7 @@ Application::Application(int& argc, char** argv, timeval &startup_time) :
|
|||
#endif
|
||||
|
||||
// tell the AgentList instance who to tell the domain server we care about
|
||||
const unsigned char agentTypesOfInterest[] = {AGENT_TYPE_AUDIO_MIXER, AGENT_TYPE_AVATAR_MIXER, AGENT_TYPE_VOXEL_SERVER};
|
||||
const char agentTypesOfInterest[] = {AGENT_TYPE_AUDIO_MIXER, AGENT_TYPE_AVATAR_MIXER, AGENT_TYPE_VOXEL_SERVER};
|
||||
AgentList::getInstance()->setAgentTypesOfInterest(agentTypesOfInterest, sizeof(agentTypesOfInterest));
|
||||
|
||||
// start the agentList threads
|
||||
|
|
|
@ -215,23 +215,29 @@ void AgentList::sendDomainServerCheckIn() {
|
|||
numBytesAgentsOfInterest + sizeof(unsigned char);
|
||||
|
||||
checkInPacket = new unsigned char[numPacketBytes];
|
||||
unsigned char* packetPosition = checkInPacket;
|
||||
|
||||
checkInPacket[0] = (memchr(SOLO_AGENT_TYPES, _ownerType, sizeof(SOLO_AGENT_TYPES)))
|
||||
*(packetPosition++) = (memchr(SOLO_AGENT_TYPES, _ownerType, sizeof(SOLO_AGENT_TYPES)))
|
||||
? PACKET_HEADER_DOMAIN_REPORT_FOR_DUTY
|
||||
: PACKET_HEADER_DOMAIN_LIST_REQUEST;
|
||||
checkInPacket[1] = _ownerType;
|
||||
*(packetPosition++) = _ownerType;
|
||||
|
||||
packSocket(checkInPacket + sizeof(PACKET_HEADER) + sizeof(AGENT_TYPE), getLocalAddress(), htons(_socketListenPort));
|
||||
packetPosition += packSocket(checkInPacket + sizeof(PACKET_HEADER) + sizeof(AGENT_TYPE),
|
||||
getLocalAddress(),
|
||||
htons(_socketListenPort));
|
||||
|
||||
// add the number of bytes for agent types of interest
|
||||
checkInPacket[numPacketBytes] = numBytesAgentsOfInterest;
|
||||
*(packetPosition++) = numBytesAgentsOfInterest;
|
||||
|
||||
// copy over the bytes for agent types of interest, if required
|
||||
if (numBytesAgentsOfInterest > 0) {
|
||||
memcpy(checkInPacket + numPacketBytes + sizeof(unsigned char),
|
||||
memcpy(packetPosition,
|
||||
_agentTypesOfInterest,
|
||||
numBytesAgentsOfInterest);
|
||||
packetPosition += numBytesAgentsOfInterest;
|
||||
}
|
||||
|
||||
*packetPosition = '\0';
|
||||
}
|
||||
|
||||
_agentSocket.send(DOMAIN_IP, DOMAINSERVER_PORT, checkInPacket, strlen((char*) checkInPacket));
|
||||
|
|
Loading…
Reference in a new issue