From 993c556000a414011626770540678948f16eaa9e Mon Sep 17 00:00:00 2001 From: lichao <lichao@aiotlink.com> Date: 星期三, 02 六月 2021 17:40:50 +0800 Subject: [PATCH] center restart with new shm; set center node ssn. --- src/robust.h | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-) diff --git a/src/robust.h b/src/robust.h index c46010a..1a3f430 100644 --- a/src/robust.h +++ b/src/robust.h @@ -67,6 +67,8 @@ typedef std::function<Data(const Data)> Handler; bool ClientRequest(const Data request, Data &reply); bool ServerProcess(Handler onReq); + AtomicReqRep() : + data_(0), timestamp_(now()) {} private: enum State { @@ -79,7 +81,7 @@ static Data Decode(Data d) { return d >> 3; } typedef std::chrono::steady_clock steady_clock; typedef steady_clock::duration Duration; - Duration now() { return steady_clock::now().time_since_epoch(); } + static Duration now() { return steady_clock::now().time_since_epoch(); } bool DataCas(Data expected, Data val) { return data_.compare_exchange_strong(expected, val); } std::atomic<Data> data_; -- Gitblit v1.8.0