Fix for streaming the same object.

This commit is contained in:
Andrzej Kapolka 2014-06-06 11:18:55 -07:00
parent 005a314695
commit 0fc6354b6c
2 changed files with 6 additions and 4 deletions

View file

@ -224,7 +224,8 @@ void Bitstream::persistWriteMappings(const WriteMappings& mappings) {
}
connect(it.key().data(), SIGNAL(destroyed(QObject*)), SLOT(clearSharedObject(QObject*)));
QPointer<SharedObject>& reference = _sharedObjectReferences[it.key()->getOriginID()];
if (reference) {
if (reference && reference != it.key()) {
// the object has been replaced by a successor, so we can forget about the original
_sharedObjectStreamer.removePersistentID(reference);
reference->disconnect(this);
}
@ -258,7 +259,8 @@ void Bitstream::persistReadMappings(const ReadMappings& mappings) {
continue;
}
QPointer<SharedObject>& reference = _sharedObjectReferences[it.value()->getRemoteOriginID()];
if (reference) {
if (reference && reference != it.value()) {
// the object has been replaced by a successor, so we can forget about the original
_sharedObjectStreamer.removePersistentValue(reference.data());
}
reference = it.value();

View file

@ -183,7 +183,7 @@ bool MetavoxelTests::run() {
bob.setOther(&alice);
// perform a large number of simulation iterations
const int SIMULATION_ITERATIONS = 100000;
const int SIMULATION_ITERATIONS = 10000;
for (int i = 0; i < SIMULATION_ITERATIONS; i++) {
if (alice.simulate(i) || bob.simulate(i)) {
return true;
@ -241,7 +241,7 @@ Endpoint::Endpoint(const QByteArray& datagramHeader) :
_receiveRecords.append(receiveRecord);
// create the object that represents out delta-encoded state
//_localState = new TestSharedObjectA();
_localState = new TestSharedObjectA();
connect(_sequencer->getReliableInputChannel(), SIGNAL(receivedMessage(const QVariant&)),
SLOT(handleReliableMessage(const QVariant&)));