agentTypesOfInterest need not be unsigned and remove debugging

This commit is contained in:
Stephen Birarda 2013-06-07 15:28:30 -07:00
parent 8c30c3ff7f
commit d33f3e43bd
2 changed files with 5 additions and 6 deletions

View file

@ -178,10 +178,10 @@ Agent* AgentList::agentWithID(uint16_t agentID) {
return NULL;
}
void AgentList::setAgentTypesOfInterest(const unsigned char* agentTypesOfInterest, int numAgentTypesOfInterest) {
void AgentList::setAgentTypesOfInterest(const char* agentTypesOfInterest, int numAgentTypesOfInterest) {
delete _agentTypesOfInterest;
_agentTypesOfInterest = new unsigned char[numAgentTypesOfInterest + sizeof(char)];
_agentTypesOfInterest = new char[numAgentTypesOfInterest + sizeof(char)];
memcpy(_agentTypesOfInterest, agentTypesOfInterest, numAgentTypesOfInterest);
_agentTypesOfInterest[numAgentTypesOfInterest] = '\0';
}
@ -209,11 +209,10 @@ void AgentList::sendDomainServerCheckIn() {
if (!checkInPacket) {
int numBytesAgentsOfInterest = _agentTypesOfInterest ? strlen((char*) _agentTypesOfInterest) : NULL;
printf("There are %d AOI\n", numBytesAgentsOfInterest);
// check in packet has header, agent type, port, IP, agent types of interest, null termination
int numPacketBytes = sizeof(PACKET_HEADER) + sizeof(AGENT_TYPE) + sizeof(uint16_t) + (sizeof(char) * 4) +
numBytesAgentsOfInterest + sizeof(char);
printf("Packet as a whole will be %d\n", numPacketBytes);
checkInPacket = new unsigned char[numPacketBytes];

View file

@ -67,7 +67,7 @@ public:
void lock() { pthread_mutex_lock(&mutex); }
void unlock() { pthread_mutex_unlock(&mutex); }
void setAgentTypesOfInterest(const unsigned char* agentTypesOfInterest, int numAgentTypesOfInterest);
void setAgentTypesOfInterest(const char* agentTypesOfInterest, int numAgentTypesOfInterest);
void sendDomainServerCheckIn();
int processDomainServerList(unsigned char *packetData, size_t dataBytes);
@ -106,7 +106,7 @@ private:
int _numAgents;
UDPSocket _agentSocket;
char _ownerType;
unsigned char* _agentTypesOfInterest;
char* _agentTypesOfInterest;
unsigned int _socketListenPort;
uint16_t _ownerID;
uint16_t _lastAgentID;