Skip to content

Commit

Permalink
fix: return error status in GetListPeers and add check for return-typ… (
Browse files Browse the repository at this point in the history
#193)

* fix: return error status in GetListPeers and add check for return-type in cmake

* ci: run actions when pull request to import-braft

* Revert "ci: run actions when pull request to import-braft"

This reverts commit 727c84d.
  • Loading branch information
longfar-ncy authored Mar 9, 2024
1 parent 65e299c commit 45c4409
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
CMAKE_MINIMUM_REQUIRED(VERSION 3.14)
PROJECT(PikiwiDB)

SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-deprecated -g -D'GIT_COMMIT_ID=\"${GIT_COMMIT_ID}\"'")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror=return-type -D'GIT_COMMIT_ID=\"${GIT_COMMIT_ID}\"'")

# Avoid warning about DOWNLOAD_EXTRACT_TIMESTAMP in CMake 3.24:
IF (CMAKE_VERSION VERSION_GREATER_EQUAL "3.24.0")
Expand Down Expand Up @@ -73,7 +73,7 @@ ELSEIF (CMAKE_SYSTEM_NAME MATCHES "Linux")
set(CMAKE_THREAD_LIBS_INIT "-lpthread")
ELSEIF (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
SET(CMAKE_EXE_LINKER_FLAGS "-static-libgcc -static-libstdc++")
SET(CMAKE_CXX_FLAGS "-pthread -Wl,--no-as-needed -ldl -Wno-restrict")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pthread -Wl,--no-as-needed -ldl")
ENDIF ()
ADD_DEFINITIONS(-DOS_LINUX)
ELSE ()
Expand Down
4 changes: 2 additions & 2 deletions src/praft/praft.cc
Original file line number Diff line number Diff line change
Expand Up @@ -156,9 +156,9 @@ braft::NodeStatus PRaft::GetNodeStatus() const {
butil::Status PRaft::GetListPeers(std::vector<braft::PeerId>* peers) {
if (!node_) {
LOG(ERROR) << "Node is not initialized";
} else {
return node_->list_peers(peers);
return {EINVAL, "Node is not initialized"};
}
return node_->list_peers(peers);
}

// Gets the cluster id, which is used to initialize node
Expand Down

0 comments on commit 45c4409

Please sign in to comment.