mirror of
https://github.com/overte-org/overte.git
synced 2025-04-25 13:53:38 +02:00
Merge branch 'master' of https://github.com/worklist/hifi into 19493
This commit is contained in:
commit
21ab08b31a
3 changed files with 29 additions and 18 deletions
|
@ -133,17 +133,26 @@ void DataServer::readPendingDatagrams() {
|
||||||
// setup a send packet with the returned data
|
// setup a send packet with the returned data
|
||||||
// leverage the packetData sent by overwriting and appending
|
// leverage the packetData sent by overwriting and appending
|
||||||
QByteArray sendPacket = byteArrayWithPopluatedHeader(PacketTypeDataServerSend, _uuid);
|
QByteArray sendPacket = byteArrayWithPopluatedHeader(PacketTypeDataServerSend, _uuid);
|
||||||
sendPacket.append(sequenceNumber);
|
QDataStream sendPacketStream(&sendPacket, QIODevice::Append);
|
||||||
|
|
||||||
if (!receivedPacket.mid(numReceivedHeaderBytes + sizeof(sequenceNumber)).startsWith("uuid")) {
|
sendPacketStream << sequenceNumber;
|
||||||
|
|
||||||
|
// pull the key list that specifies the data the user is putting/getting
|
||||||
|
QString keyListString;
|
||||||
|
packetStream >> keyListString;
|
||||||
|
|
||||||
|
if (keyListString != "uuid") {
|
||||||
|
|
||||||
|
// copy the parsed UUID
|
||||||
|
sendPacketStream << uuidStringWithoutCurlyBraces(parsedUUID);
|
||||||
|
|
||||||
const char MULTI_KEY_VALUE_SEPARATOR = '|';
|
const char MULTI_KEY_VALUE_SEPARATOR = '|';
|
||||||
|
|
||||||
// pull the key that specifies the data the user is putting/getting, null terminate it
|
// append the keyListString back to the sendPacket
|
||||||
QString keyListString;
|
sendPacketStream << keyListString;
|
||||||
packetStream >> keyListString;
|
|
||||||
|
|
||||||
QStringList keyList = keyListString.split(MULTI_KEY_VALUE_SEPARATOR);
|
QStringList keyList = keyListString.split(MULTI_KEY_VALUE_SEPARATOR);
|
||||||
|
QStringList valueList;
|
||||||
|
|
||||||
foreach (const QString& dataKey, keyList) {
|
foreach (const QString& dataKey, keyList) {
|
||||||
qDebug("Sending command to redis: GET uuid:%s:%s",
|
qDebug("Sending command to redis: GET uuid:%s:%s",
|
||||||
|
@ -155,25 +164,22 @@ void DataServer::readPendingDatagrams() {
|
||||||
|
|
||||||
if (reply->len) {
|
if (reply->len) {
|
||||||
// copy the value that redis returned
|
// copy the value that redis returned
|
||||||
sendPacket.append(reply->str, reply->len);
|
valueList << QString(reply->str);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
// didn't find a value - insert a space
|
// didn't find a value - insert a space
|
||||||
sendPacket.append(' ');
|
valueList << QChar(' ');
|
||||||
}
|
}
|
||||||
|
|
||||||
// add the multi-value separator
|
|
||||||
sendPacket.append(MULTI_KEY_VALUE_SEPARATOR);
|
|
||||||
|
|
||||||
freeReplyObject(reply);
|
freeReplyObject(reply);
|
||||||
}
|
}
|
||||||
|
|
||||||
// null terminate the packet we're sending back (erases the trailing separator)
|
// append the value QStringList using the right separator
|
||||||
sendPacket[sendPacket.size() - 1] = '\0';
|
sendPacketStream << valueList.join(MULTI_KEY_VALUE_SEPARATOR);
|
||||||
} else {
|
} else {
|
||||||
// user is asking for a UUID matching username, copy the UUID we found
|
// user was asking for their UUID
|
||||||
sendPacket.append(uuidStringWithoutCurlyBraces(parsedUUID));
|
sendPacketStream << userString;
|
||||||
sendPacket.append('\0');
|
sendPacketStream << QString("uuid");
|
||||||
|
sendPacketStream << uuidStringWithoutCurlyBraces(parsedUUID);
|
||||||
}
|
}
|
||||||
|
|
||||||
// reply back with the send packet
|
// reply back with the send packet
|
||||||
|
|
|
@ -3225,7 +3225,8 @@ void Application::displayStats() {
|
||||||
|
|
||||||
glPointSize(1.0f);
|
glPointSize(1.0f);
|
||||||
|
|
||||||
int totalAvatars = _avatarManager.size();
|
// we need to take one avatar out so we don't include ourselves
|
||||||
|
int totalAvatars = _avatarManager.size() - 1;
|
||||||
int totalServers = NodeList::getInstance()->size();
|
int totalServers = NodeList::getInstance()->size();
|
||||||
|
|
||||||
if (mirrorEnabled) {
|
if (mirrorEnabled) {
|
||||||
|
|
|
@ -234,7 +234,11 @@ void AvatarManager::processAvatarMixerDatagram(const QByteArray& datagram, const
|
||||||
|
|
||||||
// copy the rest of the packet to the avatarData holder so we can read the next Avatar from there
|
// copy the rest of the packet to the avatarData holder so we can read the next Avatar from there
|
||||||
dummyAvatarByteArray.resize(numDummyByteArrayHeaderBytes);
|
dummyAvatarByteArray.resize(numDummyByteArrayHeaderBytes);
|
||||||
dummyAvatarByteArray += datagram.mid(bytesRead);
|
|
||||||
|
// make this Avatar's UUID the UUID in the packet and tack the remaining data onto the end
|
||||||
|
dummyAvatarByteArray.replace(numDummyByteArrayHeaderBytes - NUM_BYTES_RFC4122_UUID,
|
||||||
|
NUM_BYTES_RFC4122_UUID + datagram.size() - bytesRead,
|
||||||
|
datagram.mid(bytesRead));
|
||||||
|
|
||||||
// have the matching (or new) avatar parse the data from the packet
|
// have the matching (or new) avatar parse the data from the packet
|
||||||
bytesRead += matchingAvatar->parseData(dummyAvatarByteArray);
|
bytesRead += matchingAvatar->parseData(dummyAvatarByteArray);
|
||||||
|
|
Loading…
Reference in a new issue