have killNodeWithUUID return success to avoid double lookup

This commit is contained in:
Stephen Birarda 2015-11-16 10:58:11 -08:00
parent ea38c4cc49
commit 584e35e4ab
3 changed files with 6 additions and 5 deletions

View file

@ -1836,9 +1836,7 @@ void DomainServer::processNodeDisconnectRequestPacket(QSharedPointer<NLPacket> p
qDebug() << "Received a disconnect request from node with UUID" << nodeUUID;
if (limitedNodeList->nodeWithUUID(nodeUUID)) {
limitedNodeList->killNodeWithUUID(nodeUUID);
if (limitedNodeList->killNodeWithUUID(nodeUUID)) {
static auto removedNodePacket = NLPacket::create(PacketType::DomainServerRemovedNode, NUM_BYTES_RFC4122_UUID);
removedNodePacket->reset();

View file

@ -441,7 +441,7 @@ void LimitedNodeList::reset() {
_nodeSocket.clearConnections();
}
void LimitedNodeList::killNodeWithUUID(const QUuid& nodeUUID) {
bool LimitedNodeList::killNodeWithUUID(const QUuid& nodeUUID) {
QReadLocker readLocker(&_nodeMutex);
NodeHash::iterator it = _nodeHash.find(nodeUUID);
@ -456,7 +456,10 @@ void LimitedNodeList::killNodeWithUUID(const QUuid& nodeUUID) {
}
handleNodeKill(matchingNode);
return true;
}
return false;
}
void LimitedNodeList::processKillNode(NLPacket& packet) {

View file

@ -230,7 +230,7 @@ public slots:
virtual void sendSTUNRequest();
void sendPingPackets();
void killNodeWithUUID(const QUuid& nodeUUID);
bool killNodeWithUUID(const QUuid& nodeUUID);
signals:
void dataSent(quint8 channelType, int bytes);