mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-08-08 23:17:08 +02:00
Start new hole punch when the socket is updated
This commit is contained in:
parent
78cf81954c
commit
d938e518a0
5 changed files with 14 additions and 0 deletions
|
@ -606,6 +606,12 @@ SharedNodePointer LimitedNodeList::addOrUpdateNode(const QUuid& uuid, NodeType_t
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Signal when a socket changes, so we can start the hole punch over.
|
||||||
|
auto weakPtr = newNodePointer.toWeakRef(); // We don't want the lambda to hold a strong ref
|
||||||
|
connect(newNodePointer.data(), &NetworkPeer::socketUpdated, this, [=] {
|
||||||
|
emit nodeUpdated(weakPtr);
|
||||||
|
});
|
||||||
|
|
||||||
return newNodePointer;
|
return newNodePointer;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -250,6 +250,7 @@ signals:
|
||||||
|
|
||||||
void uuidChanged(const QUuid& ownerUUID, const QUuid& oldUUID);
|
void uuidChanged(const QUuid& ownerUUID, const QUuid& oldUUID);
|
||||||
void nodeAdded(SharedNodePointer);
|
void nodeAdded(SharedNodePointer);
|
||||||
|
void nodeUpdated(SharedNodePointer);
|
||||||
void nodeKilled(SharedNodePointer);
|
void nodeKilled(SharedNodePointer);
|
||||||
void nodeActivated(SharedNodePointer);
|
void nodeActivated(SharedNodePointer);
|
||||||
|
|
||||||
|
|
|
@ -63,6 +63,7 @@ void NetworkPeer::setPublicSocket(const HifiSockAddr& publicSocket) {
|
||||||
|
|
||||||
if (!wasOldSocketNull) {
|
if (!wasOldSocketNull) {
|
||||||
qCDebug(networking) << "Public socket change for node" << *this;
|
qCDebug(networking) << "Public socket change for node" << *this;
|
||||||
|
emit socketUpdated();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -82,6 +83,7 @@ void NetworkPeer::setLocalSocket(const HifiSockAddr& localSocket) {
|
||||||
|
|
||||||
if (!wasOldSocketNull) {
|
if (!wasOldSocketNull) {
|
||||||
qCDebug(networking) << "Local socket change for node" << *this;
|
qCDebug(networking) << "Local socket change for node" << *this;
|
||||||
|
emit socketUpdated();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -101,6 +103,7 @@ void NetworkPeer::setSymmetricSocket(const HifiSockAddr& symmetricSocket) {
|
||||||
|
|
||||||
if (!wasOldSocketNull) {
|
if (!wasOldSocketNull) {
|
||||||
qCDebug(networking) << "Symmetric socket change for node" << *this;
|
qCDebug(networking) << "Symmetric socket change for node" << *this;
|
||||||
|
emit socketUpdated();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -81,9 +81,12 @@ public:
|
||||||
public slots:
|
public slots:
|
||||||
void startPingTimer();
|
void startPingTimer();
|
||||||
void stopPingTimer();
|
void stopPingTimer();
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void pingTimerTimeout();
|
void pingTimerTimeout();
|
||||||
void socketActivated(const HifiSockAddr& sockAddr);
|
void socketActivated(const HifiSockAddr& sockAddr);
|
||||||
|
void socketUpdated();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void setActiveSocket(HifiSockAddr* discoveredSocket);
|
void setActiveSocket(HifiSockAddr* discoveredSocket);
|
||||||
|
|
||||||
|
|
|
@ -93,6 +93,7 @@ NodeList::NodeList(char newOwnerType, unsigned short socketListenPort, unsigned
|
||||||
|
|
||||||
// anytime we get a new node we will want to attempt to punch to it
|
// anytime we get a new node we will want to attempt to punch to it
|
||||||
connect(this, &LimitedNodeList::nodeAdded, this, &NodeList::startNodeHolePunch);
|
connect(this, &LimitedNodeList::nodeAdded, this, &NodeList::startNodeHolePunch);
|
||||||
|
connect(this, &LimitedNodeList::nodeUpdated, this, &NodeList::startNodeHolePunch);
|
||||||
|
|
||||||
// anytime we get a new node we may need to re-send our set of ignored node IDs to it
|
// anytime we get a new node we may need to re-send our set of ignored node IDs to it
|
||||||
connect(this, &LimitedNodeList::nodeActivated, this, &NodeList::maybeSendIgnoreSetToNode);
|
connect(this, &LimitedNodeList::nodeActivated, this, &NodeList::maybeSendIgnoreSetToNode);
|
||||||
|
|
Loading…
Reference in a new issue