mirror of
https://github.com/overte-org/overte.git
synced 2025-08-07 15:50:37 +02:00
don't add a second instance of a solo node
This commit is contained in:
parent
8c5937dc78
commit
21562abfb1
2 changed files with 62 additions and 54 deletions
|
@ -167,6 +167,8 @@ int main(int argc, char* const argv[]) {
|
|||
nodeType,
|
||||
nodeList->getLastNodeID());
|
||||
|
||||
// if addOrUpdateNode returns NULL this was a solo node we already have, don't talk back to it
|
||||
if (newNode) {
|
||||
if (newNode->getNodeID() == nodeList->getLastNodeID()) {
|
||||
nodeList->increaseNodeID();
|
||||
}
|
||||
|
@ -230,6 +232,7 @@ int main(int argc, char* const argv[]) {
|
|||
broadcastPacket,
|
||||
(currentBufferPos - startPointer) + numHeaderBytes);
|
||||
}
|
||||
}
|
||||
|
||||
if (Logstash::shouldSendStats()) {
|
||||
if (usecTimestampNow() - usecTimestamp(&lastStatSendTime) >= (NODE_COUNT_STAT_INTERVAL_MSECS * 1000)) {
|
||||
|
|
|
@ -397,6 +397,11 @@ Node* NodeList::addOrUpdateNode(sockaddr* publicSocket, sockaddr* localSocket, c
|
|||
}
|
||||
|
||||
if (node == end()) {
|
||||
// if we already had this node AND it's a solo type then bust out of here
|
||||
if (soloNodeOfType(nodeType)) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// we didn't have this node, so add them
|
||||
Node* newNode = new Node(publicSocket, localSocket, nodeType, nodeId);
|
||||
|
||||
|
|
Loading…
Reference in a new issue