Use uint8_t instead of bool on the wire

This commit is contained in:
Clement 2018-11-07 17:54:49 -08:00
parent 8f763dfd50
commit ef54a63de6
2 changed files with 9 additions and 7 deletions

View file

@ -301,7 +301,7 @@ void AudioMixerClientData::parseRadiusIgnoreRequest(QSharedPointer<ReceivedMessa
void AudioMixerClientData::parseSoloRequest(QSharedPointer<ReceivedMessage> message, const SharedNodePointer& node) { void AudioMixerClientData::parseSoloRequest(QSharedPointer<ReceivedMessage> message, const SharedNodePointer& node) {
bool addToSolo; uint8_t addToSolo;
message->readPrimitive(&addToSolo); message->readPrimitive(&addToSolo);
while (message->getBytesLeftToRead()) { while (message->getBytesLeftToRead()) {

View file

@ -26,8 +26,9 @@ QVector<QUuid> AudioSolo::getUUIDs() const {
void AudioSolo::addUUIDs(QVector<QUuid> uuidList) { void AudioSolo::addUUIDs(QVector<QUuid> uuidList) {
// create a reliable NLPacket with space for the solo UUIDs // create a reliable NLPacket with space for the solo UUIDs
auto soloPacket = NLPacket::create(PacketType::AudioSoloRequest, auto soloPacket = NLPacket::create(PacketType::AudioSoloRequest,
uuidList.size() * NUM_BYTES_RFC4122_UUID + sizeof(bool), true); uuidList.size() * NUM_BYTES_RFC4122_UUID + sizeof(uint8_t), true);
soloPacket->writePrimitive(true); uint8_t addToSoloList = (uint8_t)true;
soloPacket->writePrimitive(addToSoloList);
{ {
Lock lock(_mutex); Lock lock(_mutex);
@ -42,7 +43,7 @@ void AudioSolo::addUUIDs(QVector<QUuid> uuidList) {
} }
} }
// send off this ignore packet reliably to the matching node // send off this solo packet reliably to the matching node
auto nodeList = DependencyManager::get<NodeList>(); auto nodeList = DependencyManager::get<NodeList>();
nodeList->broadcastToNodes(std::move(soloPacket), { NodeType::AudioMixer }); nodeList->broadcastToNodes(std::move(soloPacket), { NodeType::AudioMixer });
} }
@ -50,8 +51,9 @@ void AudioSolo::addUUIDs(QVector<QUuid> uuidList) {
void AudioSolo::removeUUIDs(QVector<QUuid> uuidList) { void AudioSolo::removeUUIDs(QVector<QUuid> uuidList) {
// create a reliable NLPacket with space for the solo UUIDs // create a reliable NLPacket with space for the solo UUIDs
auto soloPacket = NLPacket::create(PacketType::AudioSoloRequest, auto soloPacket = NLPacket::create(PacketType::AudioSoloRequest,
uuidList.size() * NUM_BYTES_RFC4122_UUID + sizeof(bool), true); uuidList.size() * NUM_BYTES_RFC4122_UUID + sizeof(uint8_t), true);
soloPacket->writePrimitive(false); uint8_t addToSoloList = (uint8_t)false;
soloPacket->writePrimitive(addToSoloList);
{ {
Lock lock(_mutex); Lock lock(_mutex);
@ -66,7 +68,7 @@ void AudioSolo::removeUUIDs(QVector<QUuid> uuidList) {
} }
} }
// send off this ignore packet reliably to the matching node // send off this solo packet reliably to the matching node
auto nodeList = DependencyManager::get<NodeList>(); auto nodeList = DependencyManager::get<NodeList>();
nodeList->broadcastToNodes(std::move(soloPacket), { NodeType::AudioMixer }); nodeList->broadcastToNodes(std::move(soloPacket), { NodeType::AudioMixer });
} }