added OctreeEditPacketSender::nodeKilled(), no locks yet

also added nodeKilled() calls to the 3 editsenders in
Application::nodeKilled()
This commit is contained in:
wangyix 2014-06-17 10:58:44 -07:00
parent dc71f87ea4
commit 6e71523346
3 changed files with 22 additions and 6 deletions

View file

@ -3249,10 +3249,16 @@ void Application::nodeAdded(SharedNodePointer node) {
void Application::nodeKilled(SharedNodePointer node) {
// this is here because connecting NodeList::nodeKilled to OctreePacketProcessor::nodeKilled doesn't work:
// OctreePacketProcessor::nodeKilled is not called when NodeList::nodeKilled is emitted for some reason.
// These are here because connecting NodeList::nodeKilled to OctreePacketProcessor::nodeKilled doesn't work:
// OctreePacketProcessor::nodeKilled is not being called when NodeList::nodeKilled is emitted.
// This may have to do with GenericThread::threadRoutine() blocking the QThread event loop
_octreeProcessor.nodeKilled(node);
_voxelEditSender.nodeKilled(node);
_particleEditSender.nodeKilled(node);
_modelEditSender.nodeKilled(node);
if (node->getType() == NodeType::VoxelServer) {
QUuid nodeUUID = node->getUUID();
// see if this is the first we've heard of this node...

View file

@ -393,3 +393,10 @@ void OctreeEditPacketSender::processNackPacket(const QByteArray& packet) {
}
}
}
void OctreeEditPacketSender::nodeKilled(SharedNodePointer node) {
// TODO: add locks
QUuid nodeUUID = node->getUUID();
_pendingEditPackets.remove(nodeUUID);
_sentPacketHistories.remove(nodeUUID);
}

View file

@ -91,7 +91,10 @@ public:
// you must override these...
virtual char getMyNodeType() const = 0;
virtual void adjustEditPacketForClockSkew(unsigned char* codeColorBuffer, ssize_t length, int clockSkew) { };
public slots:
void nodeKilled(SharedNodePointer node);
public:
void processNackPacket(const QByteArray& packet);
@ -120,9 +123,9 @@ protected:
unsigned short int _sequenceNumber;
int _maxPacketSize;
// TODO: garbage-collect this and _pendingEditPackets
QHash<QUuid, SentPacketHistory> _sentPacketHistories;
QMutex _releaseQueuedPacketMutex;
// TODO: add locks for this and _pendingEditPackets
QHash<QUuid, SentPacketHistory> _sentPacketHistories;
};
#endif // hifi_OctreeEditPacketSender_h