Merge branch 'protocol' of https://github.com/birarda/hifi into protocol

This commit is contained in:
Atlante45 2015-07-17 15:16:21 -07:00
commit cbf7f7c2e1
8 changed files with 22 additions and 17 deletions

View file

@ -194,9 +194,6 @@ void Agent::run() {
void Agent::aboutToFinish() {
_scriptEngine.stop();
auto& packetReceiver = DependencyManager::get<NodeList>()->getPacketReceiver();
packetReceiver.unregisterListener(DependencyManager::get<AvatarHashMap>().data());
// our entity tree is going to go away so tell that to the EntityScriptingInterface
DependencyManager::get<EntityScriptingInterface>()->setEntityTree(NULL);
}

View file

@ -579,9 +579,9 @@ const NodeSet STATICALLY_ASSIGNED_NODES = NodeSet() << NodeType::AudioMixer
void DomainServer::processConnectRequestPacket(QSharedPointer<NLPacket> packet) {
NodeType_t nodeType;
HifiSockAddr publicSockAddr, localSockAddr;
if (packet->getPayloadSize() == 0) {
// TODO: We know what size the connect packet should be (minimally) - check for that here
return;
}
@ -593,6 +593,11 @@ void DomainServer::processConnectRequestPacket(QSharedPointer<NLPacket> packet)
const HifiSockAddr& senderSockAddr = packet->getSenderSockAddr();
parseNodeData(packetStream, nodeType, publicSockAddr, localSockAddr, senderSockAddr);
if (localSockAddr.isNull() || senderSockAddr.isNull()) {
qDebug() << "Unexpected data received for node local socket or public socket. Will not allow connection.";
return;
}
// check if this connect request matches an assignment in the queue
bool isAssignment = _pendingAssignedNodes.contains(connectUUID);

View file

@ -4111,10 +4111,13 @@ void Application::registerScriptEngineWithApplicationServices(ScriptEngine* scri
// when the worker thread is started, call our engine's run..
connect(workerThread, &QThread::started, scriptEngine, &ScriptEngine::run);
// when the thread is terminated, add both scriptEngine and thread to the deleteLater queue
connect(scriptEngine, SIGNAL(doneRunning()), scriptEngine, SLOT(deleteLater()));
connect(workerThread, SIGNAL(finished()), workerThread, SLOT(deleteLater()));
connect(scriptEngine, &ScriptEngine::doneRunning, scriptEngine, &ScriptEngine::deleteLater());
connect(workerThread, &QThread::finished, workerThread, &Qthread::deleteLater);
// tell the thread to stop when the script engine is done
connect(scriptEngine, &ScriptEngine::destroyed, workerThread, &QThread::quit);
auto nodeList = DependencyManager::get<NodeList>();
connect(nodeList.data(), &NodeList::nodeKilled, scriptEngine, &ScriptEngine::nodeKilled);

View file

@ -386,7 +386,7 @@ int AvatarData::parseDataFromBuffer(const QByteArray& buffer) {
_headData->_leanSideways = leanSideways;
_headData->_torsoTwist = torsoTwist;
} // 6 bytes
{ // Lookat Position
glm::vec3 lookAt;
memcpy(&lookAt, sourceBuffer, sizeof(lookAt));

View file

@ -36,14 +36,14 @@ public:
public slots:
bool isAvatarInRange(const glm::vec3 & position, const float range);
private slots:
void sessionUUIDChanged(const QUuid& sessionUUID, const QUuid& oldUUID);
void processAvatarDataPacket(QSharedPointer<NLPacket> packet, SharedNodePointer sendingNode);
void processAvatarIdentityPacket(QSharedPointer<NLPacket> packet, SharedNodePointer sendingNode);
void processAvatarBillboardPacket(QSharedPointer<NLPacket> packet, SharedNodePointer sendingNode);
void processKillAvatar(QSharedPointer<NLPacket> packet, SharedNodePointer sendingNode);
private slots:
void sessionUUIDChanged(const QUuid& sessionUUID, const QUuid& oldUUID);
protected:
AvatarHashMap();

View file

@ -359,6 +359,11 @@ void PacketReceiver::processDatagrams() {
<< " (" << qPrintable(nameForPacketType(packet->getType())) << ")"
<< " has been destroyed. Removing from listener map.";
it = _packetListenerMap.erase(it);
// if it exists, remove the listener from _directlyConnectedObjects
_directConnectSetMutex.lock();
_directlyConnectedObjects.remove(listener.first);
_directConnectSetMutex.unlock();
}
} else {

View file

@ -38,6 +38,7 @@ public:
// standard assignment
JurisdictionMap& operator=(const JurisdictionMap& other); // copy assignment
// application constructors
JurisdictionMap(const char* filename);
JurisdictionMap(unsigned char* rootOctalCode, const std::vector<unsigned char*>& endNodes);
JurisdictionMap(const char* rootHextString, const char* endNodesHextString);

View file

@ -720,12 +720,6 @@ void ScriptEngine::run() {
}
}
// If we were on a thread, then wait till it's done
// Unless we're an assignment-client, in which case that's handled for us
if (thread() && !_isAgent) {
thread()->quit();
}
emit finished(_fileNameString);
_isRunning = false;