Networking fix.

This commit is contained in:
Andrzej Kapolka 2014-10-20 15:33:46 -07:00
parent e586b6e29b
commit d64b43693d
4 changed files with 8 additions and 7 deletions

View file

@ -237,7 +237,7 @@ void MetavoxelSession::update() {
// go back to the beginning with the current packet and note that there's a delta pending // go back to the beginning with the current packet and note that there's a delta pending
_sequencer.getOutputStream().getUnderlying().device()->seek(start); _sequencer.getOutputStream().getUnderlying().device()->seek(start);
MetavoxelDeltaPendingMessage msg = { ++_reliableDeltaID }; MetavoxelDeltaPendingMessage msg = { ++_reliableDeltaID, _lod };
out << QVariant::fromValue(msg); out << QVariant::fromValue(msg);
_sequencer.endPacket(); _sequencer.endPacket();
@ -290,7 +290,7 @@ void MetavoxelSession::sendPacketGroup(int alreadySent) {
for (int i = 0; i < additionalPackets; i++) { for (int i = 0; i < additionalPackets; i++) {
Bitstream& out = _sequencer.startPacket(); Bitstream& out = _sequencer.startPacket();
if (_reliableDeltaChannel) { if (_reliableDeltaChannel) {
MetavoxelDeltaPendingMessage msg = { _reliableDeltaID }; MetavoxelDeltaPendingMessage msg = { _reliableDeltaID, _reliableDeltaLOD };
out << QVariant::fromValue(msg); out << QVariant::fromValue(msg);
} else { } else {
out << QVariant(); out << QVariant();

View file

@ -255,12 +255,12 @@ void MetavoxelClient::handleMessage(const QVariant& message, Bitstream& in) {
} }
} else if (userType == MetavoxelDeltaPendingMessage::Type) { } else if (userType == MetavoxelDeltaPendingMessage::Type) {
// check the id to make sure this is not a delta we've already processed // check the id to make sure this is not a delta we've already processed
int id = message.value<MetavoxelDeltaPendingMessage>().id; MetavoxelDeltaPendingMessage pending = message.value<MetavoxelDeltaPendingMessage>();
if (id > _reliableDeltaID) { if (pending.id > _reliableDeltaID) {
_reliableDeltaID = id; _reliableDeltaID = pending.id;
_reliableDeltaChannel = _sequencer.getReliableInputChannel(RELIABLE_DELTA_CHANNEL_INDEX); _reliableDeltaChannel = _sequencer.getReliableInputChannel(RELIABLE_DELTA_CHANNEL_INDEX);
_reliableDeltaChannel->getBitstream().copyPersistentMappings(_sequencer.getInputStream()); _reliableDeltaChannel->getBitstream().copyPersistentMappings(_sequencer.getInputStream());
_reliableDeltaLOD = getLastAcknowledgedSendRecord()->getLOD(); _reliableDeltaLOD = pending.lod;
PacketRecord* receiveRecord = getLastAcknowledgedReceiveRecord(); PacketRecord* receiveRecord = getLastAcknowledgedReceiveRecord();
_remoteDataLOD = receiveRecord->getLOD(); _remoteDataLOD = receiveRecord->getLOD();
_remoteData = receiveRecord->getData(); _remoteData = receiveRecord->getData();

View file

@ -68,6 +68,7 @@ class MetavoxelDeltaPendingMessage {
public: public:
STREAM int id; STREAM int id;
STREAM MetavoxelLOD lod;
}; };
DECLARE_STREAMABLE_METATYPE(MetavoxelDeltaPendingMessage) DECLARE_STREAMABLE_METATYPE(MetavoxelDeltaPendingMessage)

View file

@ -81,7 +81,7 @@ PacketVersion versionForPacketType(PacketType type) {
case PacketTypeAudioStreamStats: case PacketTypeAudioStreamStats:
return 1; return 1;
case PacketTypeMetavoxelData: case PacketTypeMetavoxelData:
return 7; return 8;
case PacketTypeVoxelData: case PacketTypeVoxelData:
return VERSION_VOXELS_HAS_FILE_BREAKS; return VERSION_VOXELS_HAS_FILE_BREAKS;
default: default: