mirror of
https://github.com/overte-org/overte.git
synced 2025-04-20 04:44:11 +02:00
rebind the node socket when switching to ThreadedAssignment
This commit is contained in:
parent
0fd7ec34fc
commit
499e748d54
3 changed files with 12 additions and 0 deletions
|
@ -576,6 +576,13 @@ void LimitedNodeList::sendSTUNRequest() {
|
|||
stunSockAddr.getAddress(), stunSockAddr.getPort());
|
||||
}
|
||||
|
||||
void LimitedNodeList::rebindNodeSocket() {
|
||||
quint16 oldPort = _nodeSocket.localPort();
|
||||
|
||||
_nodeSocket.close();
|
||||
_nodeSocket.bind(QHostAddress::AnyIPv4, oldPort);
|
||||
}
|
||||
|
||||
bool LimitedNodeList::processSTUNResponse(const QByteArray& packet) {
|
||||
// check the cookie to make sure this is actually a STUN response
|
||||
// and read the first attribute and make sure it is a XOR_MAPPED_ADDRESS
|
||||
|
|
|
@ -69,6 +69,8 @@ public:
|
|||
const QUuid& getSessionUUID() const { return _sessionUUID; }
|
||||
void setSessionUUID(const QUuid& sessionUUID);
|
||||
|
||||
|
||||
void rebindNodeSocket();
|
||||
QUdpSocket& getNodeSocket() { return _nodeSocket; }
|
||||
QUdpSocket& getDTLSSocket();
|
||||
|
||||
|
|
|
@ -59,6 +59,9 @@ void ThreadedAssignment::commonInit(const QString& targetName, NodeType_t nodeTy
|
|||
NodeList* nodeList = NodeList::getInstance();
|
||||
nodeList->setOwnerType(nodeType);
|
||||
|
||||
// this is a temp fix for Qt 5.3 - rebinding the node socket gives us readyRead for the socket on this thread
|
||||
nodeList->rebindNodeSocket();
|
||||
|
||||
QTimer* domainServerTimer = new QTimer(this);
|
||||
connect(domainServerTimer, SIGNAL(timeout()), this, SLOT(checkInWithDomainServerOrExit()));
|
||||
domainServerTimer->start(DOMAIN_SERVER_CHECK_IN_MSECS);
|
||||
|
|
Loading…
Reference in a new issue