diff options
author | Determinant <[email protected]> | 2018-11-16 23:23:01 -0500 |
---|---|---|
committer | Determinant <[email protected]> | 2018-11-16 23:23:01 -0500 |
commit | e12e559e85b0c2615fb550cc11560350517efca6 (patch) | |
tree | 7ce9f5952d918213e3883032a7bc851e1f32aeb7 /include/salticidae/network.h | |
parent | 20669e2b5e956babf888bca577e39a71d83bae79 (diff) |
finish stress test coding
Diffstat (limited to 'include/salticidae/network.h')
-rw-r--r-- | include/salticidae/network.h | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/include/salticidae/network.h b/include/salticidae/network.h index 78449eb..4e182fc 100644 --- a/include/salticidae/network.h +++ b/include/salticidae/network.h @@ -622,11 +622,11 @@ void PeerNetwork<O, _, __>::start_active_conn(const NetAddr &addr) { /* begin: functions invoked by the user loop */ template<typename O, O _, O __> void PeerNetwork<O, _, __>::msg_ping(MsgPing &&msg, Conn &_conn) { - if (_conn.get_mode() == ConnPool::Conn::DEAD) return; auto conn = static_pointer_cast<Conn>(_conn.self()); - assert(conn); + if (!conn) return; uint16_t port = msg.port; this->disp_tcall->async_call([this, conn, port](ThreadCall::Handle &msg) { + if (conn->get_mode() == ConnPool::Conn::DEAD) return; SALTICIDAE_LOG_INFO("ping from %s, port %u", std::string(*conn).c_str(), ntohs(port)); if (check_new_conn(conn, port)) return; @@ -637,11 +637,11 @@ void PeerNetwork<O, _, __>::msg_ping(MsgPing &&msg, Conn &_conn) { template<typename O, O _, O __> void PeerNetwork<O, _, __>::msg_pong(MsgPong &&msg, Conn &_conn) { - if (_conn.get_mode() == ConnPool::Conn::DEAD) return; auto conn = static_pointer_cast<Conn>(_conn.self()); - assert(conn); + if (!conn) return; uint16_t port = msg.port; this->disp_tcall->async_call([this, conn, port](ThreadCall::Handle &msg) { + if (conn->get_mode() == ConnPool::Conn::DEAD) return; auto it = id2peer.find(conn->peer_id); if (it == id2peer.end()) { |