mirror of
https://github.com/overte-org/overte.git
synced 2025-08-06 18:50:00 +02:00
Merge pull request #240 from birarda/master
member variable change in AgentList
This commit is contained in:
commit
c8fbb037ab
4 changed files with 9 additions and 17 deletions
|
@ -282,8 +282,8 @@ int main(int argc, const char* argv[]) {
|
||||||
if(agentList->getAgentSocket().receive(agentAddress, packetData, &receivedBytes)) {
|
if(agentList->getAgentSocket().receive(agentAddress, packetData, &receivedBytes)) {
|
||||||
if (packetData[0] == PACKET_HEADER_INJECT_AUDIO) {
|
if (packetData[0] == PACKET_HEADER_INJECT_AUDIO) {
|
||||||
|
|
||||||
if (agentList->addOrUpdateAgent(agentAddress, agentAddress, packetData[0], agentList->getLastAgentId())) {
|
if (agentList->addOrUpdateAgent(agentAddress, agentAddress, packetData[0], agentList->getLastAgentID())) {
|
||||||
agentList->increaseAgentId();
|
agentList->increaseAgentID();
|
||||||
}
|
}
|
||||||
|
|
||||||
agentList->updateAgentWithData(agentAddress, packetData, receivedBytes);
|
agentList->updateAgentWithData(agentAddress, packetData, receivedBytes);
|
||||||
|
|
|
@ -118,8 +118,8 @@ int main(int argc, const char * argv[])
|
||||||
if (agentList->addOrUpdateAgent((sockaddr*) &agentPublicAddress,
|
if (agentList->addOrUpdateAgent((sockaddr*) &agentPublicAddress,
|
||||||
(sockaddr*) &agentLocalAddress,
|
(sockaddr*) &agentLocalAddress,
|
||||||
agentType,
|
agentType,
|
||||||
agentList->getLastAgentId())) {
|
agentList->getLastAgentID())) {
|
||||||
agentList->increaseAgentId();
|
agentList->increaseAgentID();
|
||||||
}
|
}
|
||||||
|
|
||||||
currentBufferPos = broadcastPacket + 1;
|
currentBufferPos = broadcastPacket + 1;
|
||||||
|
|
|
@ -65,7 +65,7 @@ AgentList::AgentList(char newOwnerType, unsigned int newSocketListenPort) :
|
||||||
_ownerType(newOwnerType),
|
_ownerType(newOwnerType),
|
||||||
socketListenPort(newSocketListenPort),
|
socketListenPort(newSocketListenPort),
|
||||||
_ownerID(UNKNOWN_AGENT_ID),
|
_ownerID(UNKNOWN_AGENT_ID),
|
||||||
lastAgentId(0) {
|
_lastAgentID(0) {
|
||||||
pthread_mutex_init(&mutex, 0);
|
pthread_mutex_init(&mutex, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -192,14 +192,6 @@ Agent* AgentList::agentWithID(uint16_t agentID) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint16_t AgentList::getLastAgentId() {
|
|
||||||
return lastAgentId;
|
|
||||||
}
|
|
||||||
|
|
||||||
void AgentList::increaseAgentId() {
|
|
||||||
++lastAgentId;
|
|
||||||
}
|
|
||||||
|
|
||||||
int AgentList::processDomainServerList(unsigned char *packetData, size_t dataBytes) {
|
int AgentList::processDomainServerList(unsigned char *packetData, size_t dataBytes) {
|
||||||
int readAgents = 0;
|
int readAgents = 0;
|
||||||
|
|
||||||
|
|
|
@ -52,9 +52,6 @@ public:
|
||||||
|
|
||||||
UDPSocket& getAgentSocket();
|
UDPSocket& getAgentSocket();
|
||||||
|
|
||||||
uint16_t getLastAgentId();
|
|
||||||
void increaseAgentId();
|
|
||||||
|
|
||||||
void lock() { pthread_mutex_lock(&mutex); }
|
void lock() { pthread_mutex_lock(&mutex); }
|
||||||
void unlock() { pthread_mutex_unlock(&mutex); }
|
void unlock() { pthread_mutex_unlock(&mutex); }
|
||||||
|
|
||||||
|
@ -76,6 +73,9 @@ public:
|
||||||
|
|
||||||
char getOwnerType() const { return _ownerType; }
|
char getOwnerType() const { return _ownerType; }
|
||||||
|
|
||||||
|
uint16_t getLastAgentID() const { return _lastAgentID; }
|
||||||
|
void increaseAgentID() { ++_lastAgentID; }
|
||||||
|
|
||||||
uint16_t getOwnerID() const { return _ownerID; }
|
uint16_t getOwnerID() const { return _ownerID; }
|
||||||
void setOwnerID(uint16_t ownerID) { _ownerID = ownerID; }
|
void setOwnerID(uint16_t ownerID) { _ownerID = ownerID; }
|
||||||
|
|
||||||
|
@ -105,7 +105,7 @@ private:
|
||||||
char _ownerType;
|
char _ownerType;
|
||||||
unsigned int socketListenPort;
|
unsigned int socketListenPort;
|
||||||
uint16_t _ownerID;
|
uint16_t _ownerID;
|
||||||
uint16_t lastAgentId;
|
uint16_t _lastAgentID;
|
||||||
pthread_t removeSilentAgentsThread;
|
pthread_t removeSilentAgentsThread;
|
||||||
pthread_t checkInWithDomainServerThread;
|
pthread_t checkInWithDomainServerThread;
|
||||||
pthread_t pingUnknownAgentsThread;
|
pthread_t pingUnknownAgentsThread;
|
||||||
|
|
Loading…
Reference in a new issue