diff --git a/.gitignore b/.gitignore index f61e1407..045cd250 100644 --- a/.gitignore +++ b/.gitignore @@ -13,4 +13,6 @@ nbproject/ *.pdb *.exe *.ilk -*.lib \ No newline at end of file +*.lib +.idea +cmake-build* \ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt index 980d4663..55d29a8b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -85,8 +85,12 @@ if (NOT WIN32) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC") if (APPLE) - include_directories(BEFORE /usr/local/opt/openssl/include) - link_directories(/usr/local/opt/openssl/lib) + include_directories(BEFORE + /usr/local/opt/openssl/include + ) + link_directories( + /usr/local/opt/openssl/lib + ) else() set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pthread") endif () diff --git a/examples/calculator/calc_server.cxx b/examples/calculator/calc_server.cxx index b25154b7..256f8aeb 100644 --- a/examples/calculator/calc_server.cxx +++ b/examples/calculator/calc_server.cxx @@ -152,9 +152,11 @@ void print_status(const std::string& cmd, << "current term: " << stuff.raft_instance_->get_term() << std::endl << "last snapshot log index: " - << stuff.sm_->last_snapshot()->get_last_log_idx() << std::endl + << (stuff.sm_->last_snapshot() + ? stuff.sm_->last_snapshot()->get_last_log_idx() : 0) << std::endl << "last snapshot log term: " - << stuff.sm_->last_snapshot()->get_last_log_term() << std::endl + << (stuff.sm_->last_snapshot() + ? stuff.sm_->last_snapshot()->get_last_log_term() : 0) << std::endl << "state machine value: " << get_sm()->get_current_value() << std::endl; }