aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CMakeLists.txt2
-rw-r--r--include/salticidae/network.h12
-rw-r--r--include/salticidae/stream.h2
-rw-r--r--include/salticidae/util.h1
-rw-r--r--src/util.cpp1
5 files changed, 10 insertions, 8 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 9a78538..2264f96 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -26,7 +26,7 @@ set(CMAKE_CXX_STANDARD 14)
set(CMAKE_C_STANDARD 11)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules/")
-find_package(Libuv REQUIRED)
+find_package(Libuv 1.10.0 REQUIRED)
find_package(OpenSSL 1.1.0 REQUIRED)
include_directories(include)
diff --git a/include/salticidae/network.h b/include/salticidae/network.h
index 4c5fea6..98fcd2a 100644
--- a/include/salticidae/network.h
+++ b/include/salticidae/network.h
@@ -1061,13 +1061,13 @@ PeerNetwork<O, _, __>::get_peer_conn(const NetAddr &addr) const {
if (it == known_peers.end())
throw PeerNetworkError(SALTI_ERROR_PEER_NOT_EXIST);
if (it->second->peer_id.is_null())
- {
conn = nullptr;
- return;
+ else
+ {
+ auto it2 = pid2peer.find(it->second->peer_id);
+ assert(it2 != pid2peer.end());
+ conn = it2->second->conn;
}
- auto it2 = pid2peer.find(it->second->peer_id);
- assert(it2 != pid2peer.end());
- conn = it2->second->conn;
} catch (...) {
err = std::current_exception();
}
@@ -1194,7 +1194,7 @@ template<typename OpcodeType>
inline bool ClientNetwork<OpcodeType>::_send_msg(const Msg &msg, const NetAddr &addr) {
auto it = addr2conn.find(addr);
if (it == addr2conn.end())
- throw ClientNetworkError(SALTI_ERROR_PEER_NOT_EXIST);
+ throw ClientNetworkError(SALTI_ERROR_CLIENT_NOT_EXIST);
return MsgNet::_send_msg(msg, it->second);
}
diff --git a/include/salticidae/stream.h b/include/salticidae/stream.h
index 2f41782..251e3f7 100644
--- a/include/salticidae/stream.h
+++ b/include/salticidae/stream.h
@@ -241,7 +241,7 @@ class Blob: public Serializable {
public:
- Blob(): loaded(false) {}
+ Blob(): loaded(false) { memset(data, 0, sizeof(data)); }
Blob(const bytearray_t &arr) {
if (arr.size() != N / 8)
throw std::invalid_argument("incorrect Blob size");
diff --git a/include/salticidae/util.h b/include/salticidae/util.h
index 017d301..ee0fbe3 100644
--- a/include/salticidae/util.h
+++ b/include/salticidae/util.h
@@ -86,6 +86,7 @@ enum SalticidaeErrorCode {
SALTI_ERROR_PEER_ALREADY_EXISTS,
SALTI_ERROR_PEER_NOT_EXIST,
SALTI_ERROR_PEER_NOT_READY,
+ SALTI_ERROR_CLIENT_NOT_EXIST,
SALTI_ERROR_NETADDR_INVALID,
SALTI_ERROR_OPTVAL_INVALID,
SALTI_ERROR_OPTNAME_ALREADY_EXISTS,
diff --git a/src/util.cpp b/src/util.cpp
index e88157c..7af1255 100644
--- a/src/util.cpp
+++ b/src/util.cpp
@@ -43,6 +43,7 @@ const char *SALTICIDAE_ERROR_STRINGS[] = {
"peer already exists",
"peer does not exist",
"peer is not ready",
+ "client does not exist",
"invalid NetAddr format",
"invalid OptVal format",
"option name already exists",