Ejemplo n.º 1
0
void NodeList::pingInactiveNodes() {
    foreach (const SharedNodePointer& node, getNodeHash()) {
        if (!node->getActiveSocket()) {
            // we don't have an active link to this node, ping it to set that up
            pingPunchForInactiveNode(node);
        }
    }
}
Ejemplo n.º 2
0
void NodeList::handleNodePingTimeout() {
    Node* senderNode = qobject_cast<Node*>(sender());
    if (senderNode) {
        SharedNodePointer sharedNode = nodeWithUUID(senderNode->getUUID());

        if (sharedNode && !sharedNode->getActiveSocket()) {
            pingPunchForInactiveNode(sharedNode);
        }
    }
}
Ejemplo n.º 3
0
void NodeList::startNodeHolePunch(const SharedNodePointer& node) {
    // connect to the correct signal on this node so we know when to ping it
    connect(node.data(), &Node::pingTimerTimeout, this, &NodeList::handleNodePingTimeout);

    // start the ping timer for this node
    node->startPingTimer();

    // ping this node immediately
    pingPunchForInactiveNode(node);
}