reset count on conn refusal, soft reset DH in Interface on limit reached

This commit is contained in:
Stephen Birarda 2018-01-17 13:29:20 -08:00
parent 98d581acd1
commit eb9d100fc8
4 changed files with 14 additions and 9 deletions

View file

@ -1046,8 +1046,8 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo
connect(nodeList.data(), &NodeList::packetVersionMismatch, this, &Application::notifyPacketVersionMismatch); connect(nodeList.data(), &NodeList::packetVersionMismatch, this, &Application::notifyPacketVersionMismatch);
// you might think we could just do this in NodeList but we only want this connection for Interface // you might think we could just do this in NodeList but we only want this connection for Interface
connect(&nodeList->getDomainHandler(), &DomainHandler::limitOfSilentDomainCheckInsReached, connect(&nodeList->getDomainHandler(), SIGNAL(limitOfSilentDomainCheckInsReached()),
nodeList.data(), &NodeList::reset); nodeList.data(), SLOT(reset()));
auto dialogsManager = DependencyManager::get<DialogsManager>(); auto dialogsManager = DependencyManager::get<DialogsManager>();
connect(accountManager.data(), &AccountManager::authRequired, dialogsManager.data(), &DialogsManager::showLoginDialog); connect(accountManager.data(), &AccountManager::authRequired, dialogsManager.data(), &DialogsManager::showLoginDialog);

View file

@ -383,6 +383,9 @@ void DomainHandler::processDomainServerConnectionDeniedPacket(QSharedPointer<Rec
// we're hearing from this domain-server, don't need to refresh API info // we're hearing from this domain-server, don't need to refresh API info
_apiRefreshTimer.stop(); _apiRefreshTimer.stop();
// this counts as a reply from the DS after a check in or connect packet, so reset that counter now
_checkInPacketsSinceLastReply = 0;
// Read deny reason from packet // Read deny reason from packet
uint8_t reasonCodeWire; uint8_t reasonCodeWire;

View file

@ -74,7 +74,7 @@ NodeList::NodeList(char newOwnerType, int socketListenPort, int dtlsListenPort)
connect(this, &LimitedNodeList::publicSockAddrChanged, this, &NodeList::sendDomainServerCheckIn); connect(this, &LimitedNodeList::publicSockAddrChanged, this, &NodeList::sendDomainServerCheckIn);
// clear our NodeList when the domain changes // clear our NodeList when the domain changes
connect(&_domainHandler, &DomainHandler::disconnectedFromDomain, this, &NodeList::reset); connect(&_domainHandler, SIGNAL(disconnectedFromDomain()), this, SLOT(resetFromDomainHandler()));
// send an ICE heartbeat as soon as we get ice server information // send an ICE heartbeat as soon as we get ice server information
connect(&_domainHandler, &DomainHandler::iceSocketAndIDReceived, this, &NodeList::handleICEConnectionToDomainServer); connect(&_domainHandler, &DomainHandler::iceSocketAndIDReceived, this, &NodeList::handleICEConnectionToDomainServer);
@ -91,10 +91,10 @@ NodeList::NodeList(char newOwnerType, int socketListenPort, int dtlsListenPort)
connect(accountManager.data(), &AccountManager::newKeypair, this, &NodeList::sendDomainServerCheckIn); connect(accountManager.data(), &AccountManager::newKeypair, this, &NodeList::sendDomainServerCheckIn);
// clear out NodeList when login is finished // clear out NodeList when login is finished
connect(accountManager.data(), &AccountManager::loginComplete , this, &NodeList::reset); connect(accountManager.data(), SIGNAL(loginComplete()) , this, SLOT(reset()));
// clear our NodeList when logout is requested // clear our NodeList when logout is requested
connect(accountManager.data(), &AccountManager::logoutComplete , this, &NodeList::reset); connect(accountManager.data(), SIGNAL(logoutComplete()) , this, SLOT(reset()));
// 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);
@ -230,9 +230,9 @@ void NodeList::processICEPingPacket(QSharedPointer<ReceivedMessage> message) {
sendPacket(std::move(replyPacket), message->getSenderSockAddr()); sendPacket(std::move(replyPacket), message->getSenderSockAddr());
} }
void NodeList::reset() { void NodeList::reset(bool skipDomainHandlerReset) {
if (thread() != QThread::currentThread()) { if (thread() != QThread::currentThread()) {
QMetaObject::invokeMethod(this, "reset"); QMetaObject::invokeMethod(this, "reset", Q_ARG(bool, skipDomainHandlerReset));
return; return;
} }
@ -252,7 +252,7 @@ void NodeList::reset() {
_avatarGainMap.clear(); _avatarGainMap.clear();
_avatarGainMapLock.unlock(); _avatarGainMapLock.unlock();
if (sender() != &_domainHandler) { if (!skipDomainHandlerReset) {
// clear the domain connection information, unless they're the ones that asked us to reset // clear the domain connection information, unless they're the ones that asked us to reset
_domainHandler.softReset(); _domainHandler.softReset();
} }

View file

@ -93,7 +93,9 @@ public:
void removeFromIgnoreMuteSets(const QUuid& nodeID); void removeFromIgnoreMuteSets(const QUuid& nodeID);
public slots: public slots:
void reset(); void reset(bool skipDomainHandlerReset = false);
void resetFromDomainHandler() { reset(true); }
void sendDomainServerCheckIn(); void sendDomainServerCheckIn();
void handleDSPathQuery(const QString& newPath); void handleDSPathQuery(const QString& newPath);