mirror of
https://github.com/RYDE-WORK/ballistica.git
synced 2026-02-05 23:13:46 +08:00
decrease mem usage (though still linear to replay size)
This commit is contained in:
parent
e3ef47dfc0
commit
069cd054a0
@ -134,8 +134,10 @@ void ClientSessionReplay::FetchMessages() {
|
|||||||
|
|
||||||
// If we have no messages left, read from the file until we get some.
|
// If we have no messages left, read from the file until we get some.
|
||||||
while (commands().empty()) {
|
while (commands().empty()) {
|
||||||
{
|
// Before we read next message, let's save our current state
|
||||||
// Before we read next message, let's save our current state.
|
// if we didn't that for too long.
|
||||||
|
unsaved_messages_count_ += 1;
|
||||||
|
if (unsaved_messages_count_ > 50) {
|
||||||
SessionStream out(nullptr, false);
|
SessionStream out(nullptr, false);
|
||||||
DumpFullState(&out);
|
DumpFullState(&out);
|
||||||
|
|
||||||
@ -280,7 +282,10 @@ void ClientSessionReplay::OnReset(bool rewind) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ClientSessionReplay::SaveState() { states_.push_back(current_state_); }
|
void ClientSessionReplay::SaveState() {
|
||||||
|
unsaved_messages_count_ = 0;
|
||||||
|
states_.push_back(current_state_);
|
||||||
|
}
|
||||||
|
|
||||||
void ClientSessionReplay::RestoreState(millisecs_t to_base_time) {
|
void ClientSessionReplay::RestoreState(millisecs_t to_base_time) {
|
||||||
ScreenMessage("was: " + std::to_string(base_time()) + "ms");
|
ScreenMessage("was: " + std::to_string(base_time()) + "ms");
|
||||||
|
|||||||
@ -49,6 +49,8 @@ class ClientSessionReplay : public ClientSession,
|
|||||||
std::vector<IntermediateState> states_;
|
std::vector<IntermediateState> states_;
|
||||||
IntermediateState current_state_;
|
IntermediateState current_state_;
|
||||||
|
|
||||||
|
int unsaved_messages_count_{};
|
||||||
|
|
||||||
uint32_t message_fetch_num_{};
|
uint32_t message_fetch_num_{};
|
||||||
bool have_sent_client_message_{};
|
bool have_sent_client_message_{};
|
||||||
std::vector<ConnectionToClient*> connections_to_clients_;
|
std::vector<ConnectionToClient*> connections_to_clients_;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user