mirror of
https://github.com/overte-org/overte.git
synced 2025-08-04 07:03:41 +02:00
fix pinging of agents in broadcast to nodes
This commit is contained in:
parent
964200cdab
commit
75d8934961
1 changed files with 6 additions and 5 deletions
|
@ -601,6 +601,7 @@ void NodeList::pingPublicAndLocalSocketsForInactiveNode(Node* node) const {
|
||||||
currentTime = usecTimestampNow();
|
currentTime = usecTimestampNow();
|
||||||
memcpy(pingPacket + numHeaderBytes, ¤tTime, sizeof(currentTime));
|
memcpy(pingPacket + numHeaderBytes, ¤tTime, sizeof(currentTime));
|
||||||
|
|
||||||
|
qDebug() << "Attemping to ping" << *node << "\n";
|
||||||
// send the ping packet to the local and public sockets for this node
|
// send the ping packet to the local and public sockets for this node
|
||||||
_nodeSocket.send(node->getLocalSocket(), pingPacket, sizeof(pingPacket));
|
_nodeSocket.send(node->getLocalSocket(), pingPacket, sizeof(pingPacket));
|
||||||
_nodeSocket.send(node->getPublicSocket(), pingPacket, sizeof(pingPacket));
|
_nodeSocket.send(node->getPublicSocket(), pingPacket, sizeof(pingPacket));
|
||||||
|
@ -657,17 +658,17 @@ unsigned NodeList::broadcastToNodes(unsigned char* broadcastData, size_t dataByt
|
||||||
unsigned n = 0;
|
unsigned n = 0;
|
||||||
for(NodeList::iterator node = begin(); node != end(); node++) {
|
for(NodeList::iterator node = begin(); node != end(); node++) {
|
||||||
// only send to the NodeTypes we are asked to send to.
|
// only send to the NodeTypes we are asked to send to.
|
||||||
if (node->getActiveSocket() != NULL) {
|
|
||||||
if (memchr(nodeTypes, node->getType(), numNodeTypes)) {
|
if (memchr(nodeTypes, node->getType(), numNodeTypes)) {
|
||||||
|
if (node->getActiveSocket()) {
|
||||||
// we know which socket is good for this node, send there
|
// we know which socket is good for this node, send there
|
||||||
_nodeSocket.send(node->getActiveSocket(), broadcastData, dataBytes);
|
_nodeSocket.send(node->getActiveSocket(), broadcastData, dataBytes);
|
||||||
++n;
|
++n;
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
// we don't have an active link to this node, ping it to set that up
|
// we don't have an active link to this node, ping it to set that up
|
||||||
pingPublicAndLocalSocketsForInactiveNode(&(*node));
|
pingPublicAndLocalSocketsForInactiveNode(&(*node));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return n;
|
return n;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue