Skip to content
This repository has been archived by the owner on Sep 21, 2020. It is now read-only.

Commit

Permalink
Assign received sequence number on receiving an unknown entry (#250)
Browse files Browse the repository at this point in the history
  • Loading branch information
virtuald authored and PeterJohnson committed Oct 28, 2017
1 parent ded1beb commit fd32350
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/main/native/cpp/Storage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ void Storage::ProcessIncomingEntryAssign(std::shared_ptr<Message> 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
Expand All @@ -101,6 +102,7 @@ void Storage::ProcessIncomingEntryAssign(std::shared_ptr<Message> msg,
if (entry->id != 0xffff) return;

entry->flags = msg->flags();
entry->seq_num = seq_num;
SetEntryValueImpl(entry, msg->value(), lock, false);
return;
}
Expand Down Expand Up @@ -131,6 +133,7 @@ void Storage::ProcessIncomingEntryAssign(std::shared_ptr<Message> 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,
Expand All @@ -154,7 +157,6 @@ void Storage::ProcessIncomingEntryAssign(std::shared_ptr<Message> 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;
Expand Down

0 comments on commit fd32350

Please sign in to comment.