Skip to content

Commit

Permalink
Address coverity issues
Browse files Browse the repository at this point in the history
Signed-off-by: Gautam Venkataramanan <gautam.chennai@gmail.com>
  • Loading branch information
gautvenk committed Aug 14, 2020
1 parent 9a79906 commit 819bd2e
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 0 deletions.
3 changes: 3 additions & 0 deletions libopflex/engine/OpflexPool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -448,6 +448,9 @@ void OpflexPool::validatePeerSet(OpflexClientConnection * conn, const peer_name_
for (const conn_map_t::value_type& cv : conns) {
OpflexClientConnection* c = cv.second.conn;
OpflexClientConnection* srcPeer = getPeer(conn->getHostname(), conn->getPort());
if (!srcPeer)
continue;

peer_name_t peer_name = make_pair(c->getHostname(), c->getPort());
if ((peers.find(peer_name) == peers.end()) &&
(configured_peers.find(peer_name) == configured_peers.end()) &&
Expand Down
6 changes: 6 additions & 0 deletions libopflex/engine/OpflexServerConnection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,9 @@ void OpflexServerConnection::on_policy_update_async(uv_async_t* handle) {
OpflexServerConnection* conn = (OpflexServerConnection *)handle->data;
GbpOpflexServerImpl* server = dynamic_cast<GbpOpflexServerImpl*>
(conn->listener->getHandlerFactory());
if (!server)
return;

const std::lock_guard<std::recursive_mutex> guard(conn->listener->conn_mutex);
const std::lock_guard<std::mutex> lock(conn->ref_vec_mutex);

Expand All @@ -251,6 +254,9 @@ void OpflexServerConnection::on_prr_timer_async(uv_async_t* handle) {
OpflexServerConnection* conn = (OpflexServerConnection *)handle->data;
GbpOpflexServerImpl* server = dynamic_cast<GbpOpflexServerImpl*>
(conn->listener->getHandlerFactory());
if (!server)
return;

const std::lock_guard<std::recursive_mutex> guard(conn->listener->conn_mutex);
const std::lock_guard<std::mutex> lock(conn->uri_map_mutex);

Expand Down
4 changes: 4 additions & 0 deletions libopflex/engine/OpflexServerHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,8 @@ void OpflexServerHandler::handleSendIdentityReq(const rapidjson::Value& id,
void OpflexServerHandler::handlePolicyResolveReq(const rapidjson::Value& id,
const Value& payload) {
OpflexServerConnection* conn = dynamic_cast<OpflexServerConnection*>(getConnection());
if (!conn)
return;

LOG(DEBUG) << "Got policy_resolve req from " << conn->getRemotePeer();

Expand Down Expand Up @@ -332,6 +334,8 @@ void OpflexServerHandler::handlePolicyResolveReq(const rapidjson::Value& id,
void OpflexServerHandler::handlePolicyUnresolveReq(const rapidjson::Value& id,
const rapidjson::Value& payload) {
OpflexServerConnection* conn = dynamic_cast<OpflexServerConnection*>(getConnection());
if (!conn)
return;

LOG(DEBUG) << "Got policy_unresolve req from " << conn->getRemotePeer();
Value::ConstValueIterator it;
Expand Down

0 comments on commit 819bd2e

Please sign in to comment.