mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-01-10 21:49:38 -06:00
Correctly rollback the previous rollback
This commit is contained in:
@@ -32,22 +32,29 @@ SyncBuffer::SyncBuffer(size_t n)
|
||||
: _n(n)
|
||||
, _encodeOffset(0)
|
||||
, _decodeOffset(0)
|
||||
, _synchronizationBuffer(new sgct::SharedVector<char>())
|
||||
{
|
||||
_dataStream.resize(_n);
|
||||
}
|
||||
|
||||
SyncBuffer::~SyncBuffer() {
|
||||
// The destructor is defined here, so that the otherwise default inlined destructor is
|
||||
// not created (which would make it impossible to use a forward declaration with
|
||||
// unique_ptr
|
||||
}
|
||||
|
||||
void SyncBuffer::write() {
|
||||
_synchronizationBuffer.setVal(_dataStream);
|
||||
sgct::SharedData::instance()->writeVector(&_synchronizationBuffer);
|
||||
_synchronizationBuffer->setVal(_dataStream);
|
||||
sgct::SharedData::instance()->writeVector(_synchronizationBuffer.get());
|
||||
_encodeOffset = 0;
|
||||
_decodeOffset = 0;
|
||||
}
|
||||
|
||||
void SyncBuffer::read() {
|
||||
sgct::SharedData::instance()->readVector(&_synchronizationBuffer);
|
||||
_dataStream = std::move(_synchronizationBuffer.getVal());
|
||||
sgct::SharedData::instance()->readVector(_synchronizationBuffer.get());
|
||||
_dataStream = std::move(_synchronizationBuffer->getVal());
|
||||
_encodeOffset = 0;
|
||||
_decodeOffset = 0;
|
||||
}
|
||||
|
||||
} // namespace openspace
|
||||
} // namespace openspace
|
||||
|
||||
Reference in New Issue
Block a user