diff options
author | Determinant <[email protected]> | 2018-11-21 23:34:31 -0500 |
---|---|---|
committer | Determinant <[email protected]> | 2018-11-21 23:34:31 -0500 |
commit | b84b00cb9d17a51b2667716229dd3ecde756b709 (patch) | |
tree | d4e41f307836f0a5dc7704835acc6ab221d27012 | |
parent | 27304354844c8baf8c14ef923e0ab65bc4df2dc0 (diff) |
fix minor bugs
-rw-r--r-- | include/salticidae/network.h | 10 | ||||
-rw-r--r-- | src/util.cpp | 1 |
2 files changed, 5 insertions, 6 deletions
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<O, _, __>::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<O, _, __>::start_active_conn(const NetAddr &addr) { auto p = id2peer.find(addr)->second.get(); if (p->connected) return; auto conn = static_pointer_cast<Conn>(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<OpcodeType>::Conn::on_setup() { template<typename OpcodeType> void ClientNetwork<OpcodeType>::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<OpcodeType>::send_msg(MsgType &&msg, const NetAddr &addr) { this->disp_tcall->async_call( [this, addr, msg=std::forward<MsgType>(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); }); } diff --git a/src/util.cpp b/src/util.cpp index 2a6a381..a0d5044 100644 --- a/src/util.cpp +++ b/src/util.cpp @@ -236,6 +236,7 @@ bool Config::load(const std::string &fname) { } update(optname, optval.c_str()); } + fclose(conf_f); return true; } else |