mirror of
https://github.com/overte-org/overte.git
synced 2025-04-19 16:23:39 +02:00
more repairs to Agent and AvatarData for UUID transition
This commit is contained in:
parent
d7d8d76b07
commit
8f1135feb7
7 changed files with 25 additions and 34 deletions
|
@ -182,14 +182,17 @@ void Agent::run() {
|
|||
NodeList::getInstance()->pingPublicAndLocalSocketsForInactiveNode(audioMixer);
|
||||
}
|
||||
|
||||
// allow the scripter's call back to setup visual data
|
||||
emit willSendVisualDataCallback();
|
||||
|
||||
// release the queue of edit voxel messages.
|
||||
voxelScripter.getVoxelPacketSender()->releaseQueuedMessages();
|
||||
|
||||
// since we're in non-threaded mode, call process so that the packets are sent
|
||||
voxelScripter.getVoxelPacketSender()->process();
|
||||
if (voxelScripter.getVoxelPacketSender()->voxelServersExist()) {
|
||||
// allow the scripter's call back to setup visual data
|
||||
emit willSendVisualDataCallback();
|
||||
|
||||
// release the queue of edit voxel messages.
|
||||
voxelScripter.getVoxelPacketSender()->releaseQueuedMessages();
|
||||
|
||||
// since we're in non-threaded mode, call process so that the packets are sent
|
||||
voxelScripter.getVoxelPacketSender()->process();
|
||||
|
||||
}
|
||||
|
||||
if (engine.hasUncaughtException()) {
|
||||
int line = engine.uncaughtExceptionLineNumber();
|
||||
|
|
|
@ -50,6 +50,7 @@ void VoxelPacketProcessor::processPacket(sockaddr& senderAddress, unsigned char*
|
|||
if (packetData[0] == PACKET_TYPE_ENVIRONMENT_DATA) {
|
||||
app->_environment.parseData(&senderAddress, packetData, messageLength);
|
||||
} else {
|
||||
app->_voxels.setDataSourceID(0);
|
||||
app->_voxels.parseData(packetData, messageLength);
|
||||
app->_voxels.setDataSourceID(0);
|
||||
}
|
||||
|
|
|
@ -54,25 +54,6 @@ AvatarData::~AvatarData() {
|
|||
delete _handData;
|
||||
}
|
||||
|
||||
void AvatarData::sendData() {
|
||||
|
||||
// called from Agent visual loop to send data
|
||||
if (Node* avatarMixer = NodeList::getInstance()->soloNodeOfType(NODE_TYPE_AVATAR_MIXER)) {
|
||||
unsigned char packet[MAX_PACKET_SIZE];
|
||||
|
||||
unsigned char* endOfPacket = packet;
|
||||
endOfPacket += populateTypeAndVersion(endOfPacket, PACKET_TYPE_HEAD_DATA);
|
||||
|
||||
QByteArray rfcUUID = NodeList::getInstance()->getOwnerUUID().toRfc4122();
|
||||
memcpy(endOfPacket, rfcUUID.constData(), rfcUUID.size());
|
||||
endOfPacket += rfcUUID.size();
|
||||
|
||||
int numPacketBytes = (endOfPacket - packet) + getBroadcastData(endOfPacket);
|
||||
|
||||
NodeList::getInstance()->getNodeSocket()->send(avatarMixer->getActiveSocket(), packet, numPacketBytes);
|
||||
}
|
||||
}
|
||||
|
||||
int AvatarData::getBroadcastData(unsigned char* destinationBuffer) {
|
||||
unsigned char* bufferStart = destinationBuffer;
|
||||
|
||||
|
@ -108,7 +89,7 @@ int AvatarData::getBroadcastData(unsigned char* destinationBuffer) {
|
|||
|
||||
// Follow mode info
|
||||
memcpy(destinationBuffer, _leaderUUID.toRfc4122().constData(), NUM_BYTES_RFC4122_UUID);
|
||||
destinationBuffer += sizeof(NUM_BYTES_RFC4122_UUID);
|
||||
destinationBuffer += NUM_BYTES_RFC4122_UUID;
|
||||
|
||||
// Head rotation (NOTE: This needs to become a quaternion to save two bytes)
|
||||
destinationBuffer += packFloatAngleToTwoByte(destinationBuffer, _headData->_yaw);
|
||||
|
|
|
@ -126,7 +126,6 @@ public:
|
|||
void setHandData(HandData* handData) { _handData = handData; }
|
||||
|
||||
public slots:
|
||||
void sendData();
|
||||
void setWantLowResMoving(bool wantLowResMoving) { _wantLowResMoving = wantLowResMoving; }
|
||||
void setWantColor(bool wantColor) { _wantColor = wantColor; }
|
||||
void setWantDelta(bool wantDelta) { _wantDelta = wantDelta; }
|
||||
|
|
|
@ -313,7 +313,7 @@ const uint32_t RFC_5389_MAGIC_COOKIE_NETWORK_ORDER = htonl(0x2112A442);
|
|||
const int NUM_BYTES_STUN_HEADER = 20;
|
||||
|
||||
void NodeList::sendSTUNRequest() {
|
||||
const char STUN_SERVER_HOSTNAME[] = "root.highfidelity.io";
|
||||
const char STUN_SERVER_HOSTNAME[] = "stun.highfidelity.io";
|
||||
const unsigned short STUN_SERVER_PORT = 3478;
|
||||
|
||||
unsigned char stunRequestPacket[NUM_BYTES_STUN_HEADER];
|
||||
|
|
|
@ -107,10 +107,15 @@ void VoxelEditPacketSender::queuePacketToNode(const QUuid& nodeUUID, unsigned ch
|
|||
NodeList* nodeList = NodeList::getInstance();
|
||||
for (NodeList::iterator node = nodeList->begin(); node != nodeList->end(); node++) {
|
||||
// only send to the NodeTypes that are NODE_TYPE_VOXEL_SERVER
|
||||
if (node->getActiveSocket() && node->getType() == NODE_TYPE_VOXEL_SERVER &&
|
||||
if (node->getType() == NODE_TYPE_VOXEL_SERVER &&
|
||||
((node->getUUID() == nodeUUID) || (nodeUUID.isNull()))) {
|
||||
sockaddr* nodeAddress = node->getActiveSocket();
|
||||
queuePacketForSending(*nodeAddress, buffer, length);
|
||||
if (node->getActiveSocket()) {
|
||||
sockaddr* nodeAddress = node->getActiveSocket();
|
||||
queuePacketForSending(*nodeAddress, buffer, length);
|
||||
} else {
|
||||
// we don't have an active socket for this node, ping it
|
||||
nodeList->pingPublicAndLocalSocketsForInactiveNode(&(*node));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -83,6 +83,8 @@ public:
|
|||
|
||||
// the default number of pending messages we will store if no voxel servers are available
|
||||
static const int DEFAULT_MAX_PENDING_MESSAGES;
|
||||
|
||||
bool voxelServersExist() const;
|
||||
|
||||
private:
|
||||
bool _shouldSend;
|
||||
|
@ -90,7 +92,7 @@ private:
|
|||
void queuePacketToNodes(unsigned char* buffer, ssize_t length);
|
||||
void initializePacket(EditPacketBuffer& packetBuffer, PACKET_TYPE type);
|
||||
void releaseQueuedPacket(EditPacketBuffer& packetBuffer); // releases specific queued packet
|
||||
bool voxelServersExist() const;
|
||||
|
||||
void processPreServerExistsPackets();
|
||||
|
||||
// These are packets which are destined from know servers but haven't been released because they're still too small
|
||||
|
|
Loading…
Reference in a new issue