From 51064f5e75620b2c94ce8b70ad92fa8d2906f385 Mon Sep 17 00:00:00 2001 From: Peter Johnson Date: Sun, 27 Sep 2015 01:53:49 -0700 Subject: [PATCH] Fix client initial flags setting. Before the server has assigned the id, the client doesn't generate flags update messages. This behavior is correct, but the client must then send the appropriate flags update message when the id is finally assigned by the server. --- src/Storage.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/Storage.cpp b/src/Storage.cpp index c36de1a267..d113b9aeec 100644 --- a/src/Storage.cpp +++ b/src/Storage.cpp @@ -142,6 +142,16 @@ void Storage::ProcessIncoming(std::shared_ptr msg, entry = new_entry.get(); entry->id = id; m_idmap[id] = entry; + + // if the received flags don't match what we sent, we most likely + // updated flags locally in the interim; send flags update message. + if (msg->flags() != entry->flags) { + auto queue_outgoing = m_queue_outgoing; + auto outmsg = Message::FlagsUpdate(id, entry->flags); + lock.unlock(); + queue_outgoing(outmsg, nullptr, nullptr); + lock.lock(); + } } } @@ -168,7 +178,8 @@ void Storage::ProcessIncoming(std::shared_ptr msg, } // don't update flags from a <3.0 remote (not part of message) - if (conn->proto_rev() >= 0x0300) { + // don't update flags if this is a server response to a client id request + if (!may_need_update && conn->proto_rev() >= 0x0300) { // update persistent dirty flag if persistent flag changed if ((entry->flags & NT_PERSISTENT) != (msg->flags() & NT_PERSISTENT)) m_persistent_dirty = true;