From b84b00cb9d17a51b2667716229dd3ecde756b709 Mon Sep 17 00:00:00 2001 From: Determinant Date: Wed, 21 Nov 2018 23:34:31 -0500 Subject: fix minor bugs --- include/salticidae/network.h | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'include') diff --git a/include/salticidae/network.h b/include/salticidae/network.h index 0a0ccb9..0f7ed7d 100644 --- a/include/salticidae/network.h +++ b/include/salticidae/network.h @@ -505,7 +505,7 @@ void PeerNetwork::Conn::on_teardown() { if (this != p->conn.get()) return; p->ev_ping_timer.del(); p->connected = false; - p->conn = nullptr; + //p->conn = nullptr; SALTICIDAE_LOG_INFO("connection lost: %s", std::string(*this).c_str()); // try to reconnect p->ev_retry_timer = TimerEvent(pn->disp_ec, @@ -603,7 +603,7 @@ void PeerNetwork::start_active_conn(const NetAddr &addr) { auto p = id2peer.find(addr)->second.get(); if (p->connected) return; auto conn = static_pointer_cast(MsgNet::_connect(addr)); - assert(p->conn == nullptr); + //assert(p->conn == nullptr); p->conn = conn; conn->peer_id = addr; if (id_mode == IP_BASED) @@ -714,7 +714,6 @@ void ClientNetwork::Conn::on_setup() { template void ClientNetwork::Conn::on_teardown() { MsgNet::Conn::on_teardown(); - assert(this->get_mode() == Conn::PASSIVE); get_net()->addr2conn.erase(this->get_addr()); } @@ -724,9 +723,8 @@ void ClientNetwork::send_msg(MsgType &&msg, const NetAddr &addr) { this->disp_tcall->async_call( [this, addr, msg=std::forward(msg)](ThreadCall::Handle &) { auto it = addr2conn.find(addr); - if (it == addr2conn.end()) - throw PeerNetworkError("client does not exist"); - send_msg(msg, it->second); + if (it != addr2conn.end()) + send_msg(msg, it->second); }); } -- cgit v1.2.3