mirror of
https://github.com/overte-org/overte.git
synced 2025-08-08 21:36:47 +02:00
cleanup node silence timing and use for DTLS timeouts
This commit is contained in:
parent
c840904642
commit
e2224e0f0c
7 changed files with 9 additions and 8 deletions
|
@ -801,7 +801,7 @@ AnimationServer::AnimationServer(int &argc, char **argv) :
|
||||||
|
|
||||||
QTimer* silentNodeTimer = new QTimer(this);
|
QTimer* silentNodeTimer = new QTimer(this);
|
||||||
connect(silentNodeTimer, SIGNAL(timeout()), nodeList, SLOT(removeSilentNodes()));
|
connect(silentNodeTimer, SIGNAL(timeout()), nodeList, SLOT(removeSilentNodes()));
|
||||||
silentNodeTimer->start(NODE_SILENCE_THRESHOLD_USECS / 1000);
|
silentNodeTimer->start(NODE_SILENCE_THRESHOLD_MSECS);
|
||||||
|
|
||||||
connect(&nodeList->getNodeSocket(), SIGNAL(readyRead()), SLOT(readPendingDatagrams()));
|
connect(&nodeList->getNodeSocket(), SIGNAL(readyRead()), SLOT(readPendingDatagrams()));
|
||||||
}
|
}
|
||||||
|
|
|
@ -216,7 +216,7 @@ void DomainServer::setupNodeListAndAssignments(const QUuid& sessionUUID) {
|
||||||
|
|
||||||
QTimer* silentNodeTimer = new QTimer(this);
|
QTimer* silentNodeTimer = new QTimer(this);
|
||||||
connect(silentNodeTimer, SIGNAL(timeout()), nodeList, SLOT(removeSilentNodes()));
|
connect(silentNodeTimer, SIGNAL(timeout()), nodeList, SLOT(removeSilentNodes()));
|
||||||
silentNodeTimer->start(NODE_SILENCE_THRESHOLD_USECS / 1000);
|
silentNodeTimer->start(NODE_SILENCE_THRESHOLD_MSECS);
|
||||||
|
|
||||||
connect(&nodeList->getNodeSocket(), SIGNAL(readyRead()), SLOT(readAvailableDatagrams()));
|
connect(&nodeList->getNodeSocket(), SIGNAL(readyRead()), SLOT(readAvailableDatagrams()));
|
||||||
|
|
||||||
|
|
|
@ -274,7 +274,7 @@ Application::Application(int& argc, char** argv, timeval &startup_time) :
|
||||||
QTimer* silentNodeTimer = new QTimer();
|
QTimer* silentNodeTimer = new QTimer();
|
||||||
connect(silentNodeTimer, SIGNAL(timeout()), nodeList, SLOT(removeSilentNodes()));
|
connect(silentNodeTimer, SIGNAL(timeout()), nodeList, SLOT(removeSilentNodes()));
|
||||||
silentNodeTimer->moveToThread(_nodeThread);
|
silentNodeTimer->moveToThread(_nodeThread);
|
||||||
silentNodeTimer->start(NODE_SILENCE_THRESHOLD_USECS / 1000);
|
silentNodeTimer->start(NODE_SILENCE_THRESHOLD_MSECS);
|
||||||
|
|
||||||
// send the identity packet for our avatar each second to our avatar mixer
|
// send the identity packet for our avatar each second to our avatar mixer
|
||||||
QTimer* identityPacketTimer = new QTimer();
|
QTimer* identityPacketTimer = new QTimer();
|
||||||
|
|
|
@ -95,8 +95,9 @@ DTLSSession::DTLSSession(int end, QUdpSocket& dtlsSocket, HifiSockAddr& destinat
|
||||||
const unsigned int DTLS_MAX_MTU = 1452;
|
const unsigned int DTLS_MAX_MTU = 1452;
|
||||||
gnutls_dtls_set_mtu(_gnutlsSession, DTLS_MAX_MTU);
|
gnutls_dtls_set_mtu(_gnutlsSession, DTLS_MAX_MTU);
|
||||||
|
|
||||||
const unsigned int DTLS_TOTAL_CONNECTION_TIMEOUT = 10 * DOMAIN_SERVER_CHECK_IN_MSECS;
|
const unsigned int DTLS_HANDSHAKE_RETRANSMISSION_TIMEOUT = DOMAIN_SERVER_CHECK_IN_MSECS;
|
||||||
gnutls_dtls_set_timeouts(_gnutlsSession, 1, DTLS_TOTAL_CONNECTION_TIMEOUT);
|
const unsigned int DTLS_TOTAL_CONNECTION_TIMEOUT = 2 * NODE_SILENCE_THRESHOLD_MSECS;
|
||||||
|
gnutls_dtls_set_timeouts(_gnutlsSession, DTLS_HANDSHAKE_RETRANSMISSION_TIMEOUT, DTLS_TOTAL_CONNECTION_TIMEOUT);
|
||||||
|
|
||||||
gnutls_transport_set_ptr(_gnutlsSession, this);
|
gnutls_transport_set_ptr(_gnutlsSession, this);
|
||||||
gnutls_transport_set_push_function(_gnutlsSession, socketPush);
|
gnutls_transport_set_push_function(_gnutlsSession, socketPush);
|
||||||
|
|
|
@ -426,7 +426,7 @@ void LimitedNodeList::removeSilentNodes() {
|
||||||
|
|
||||||
node->getMutex().lock();
|
node->getMutex().lock();
|
||||||
|
|
||||||
if ((usecTimestampNow() - node->getLastHeardMicrostamp()) > NODE_SILENCE_THRESHOLD_USECS) {
|
if ((usecTimestampNow() - node->getLastHeardMicrostamp()) > (NODE_SILENCE_THRESHOLD_MSECS * 1000)) {
|
||||||
// call our private method to kill this node (removes it and emits the right signal)
|
// call our private method to kill this node (removes it and emits the right signal)
|
||||||
nodeItem = killNodeAtHashIterator(nodeItem);
|
nodeItem = killNodeAtHashIterator(nodeItem);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -36,7 +36,7 @@
|
||||||
|
|
||||||
const int MAX_PACKET_SIZE = 1500;
|
const int MAX_PACKET_SIZE = 1500;
|
||||||
|
|
||||||
const quint64 NODE_SILENCE_THRESHOLD_USECS = 2 * 1000 * 1000;
|
const quint64 NODE_SILENCE_THRESHOLD_MSECS = 2 * 1000;
|
||||||
|
|
||||||
extern const char SOLO_NODE_TYPES[2];
|
extern const char SOLO_NODE_TYPES[2];
|
||||||
|
|
||||||
|
|
|
@ -45,7 +45,7 @@ void ThreadedAssignment::commonInit(const QString& targetName, NodeType_t nodeTy
|
||||||
|
|
||||||
QTimer* silentNodeRemovalTimer = new QTimer(this);
|
QTimer* silentNodeRemovalTimer = new QTimer(this);
|
||||||
connect(silentNodeRemovalTimer, SIGNAL(timeout()), nodeList, SLOT(removeSilentNodes()));
|
connect(silentNodeRemovalTimer, SIGNAL(timeout()), nodeList, SLOT(removeSilentNodes()));
|
||||||
silentNodeRemovalTimer->start(NODE_SILENCE_THRESHOLD_USECS / 1000);
|
silentNodeRemovalTimer->start(NODE_SILENCE_THRESHOLD_MSECS);
|
||||||
|
|
||||||
if (shouldSendStats) {
|
if (shouldSendStats) {
|
||||||
// send a stats packet every 1 second
|
// send a stats packet every 1 second
|
||||||
|
|
Loading…
Reference in a new issue