From fd32350dc68c730d702e0fad50018a774762db0d Mon Sep 17 00:00:00 2001 From: Dustin Spicuzza Date: Sat, 28 Oct 2017 04:07:17 -0400 Subject: [PATCH] Assign received sequence number on receiving an unknown entry (#250) --- src/main/native/cpp/Storage.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main/native/cpp/Storage.cpp b/src/main/native/cpp/Storage.cpp index bb51481..8adc914 100644 --- a/src/main/native/cpp/Storage.cpp +++ b/src/main/native/cpp/Storage.cpp @@ -91,6 +91,7 @@ void Storage::ProcessIncomingEntryAssign(std::shared_ptr msg, StringRef name = msg->str(); Entry* entry; bool may_need_update = false; + SequenceNumber seq_num(msg->seq_num_uid()); if (m_server) { // if we're a server, id=0xffff requests are requests for an id // to be assigned, and we need to send the new assignment back to @@ -101,6 +102,7 @@ void Storage::ProcessIncomingEntryAssign(std::shared_ptr msg, if (entry->id != 0xffff) return; entry->flags = msg->flags(); + entry->seq_num = seq_num; SetEntryValueImpl(entry, msg->value(), lock, false); return; } @@ -131,6 +133,7 @@ void Storage::ProcessIncomingEntryAssign(std::shared_ptr msg, // id assignment request) entry->value = msg->value(); entry->flags = msg->flags(); + entry->seq_num = seq_num; // notify m_notifier.NotifyEntry(entry->local_id, name, entry->value, @@ -154,7 +157,6 @@ void Storage::ProcessIncomingEntryAssign(std::shared_ptr msg, // common client and server handling // already exists; ignore if sequence number not higher than local - SequenceNumber seq_num(msg->seq_num_uid()); if (seq_num < entry->seq_num) { if (may_need_update) { auto dispatcher = m_dispatcher;