diff options
author | Determinant <[email protected]> | 2019-06-29 14:13:59 -0400 |
---|---|---|
committer | Determinant <[email protected]> | 2019-06-29 14:13:59 -0400 |
commit | 54f5abf3d4dac9cdf04846d5b952799c31753c9d (patch) | |
tree | 77c4c004a5d72fc59e8a2a433aef086893a51c0a /src | |
parent | 8d242e0112c7f9072600a48366ebbd6ce7b5c727 (diff) |
...
Diffstat (limited to 'src')
-rw-r--r-- | src/conn.cpp | 17 |
1 files changed, 6 insertions, 11 deletions
diff --git a/src/conn.cpp b/src/conn.cpp index b6c6c71..f26c480 100644 --- a/src/conn.cpp +++ b/src/conn.cpp @@ -45,7 +45,6 @@ ConnPool::Conn::operator std::string() const { { case Conn::ACTIVE: s << "active"; break; case Conn::PASSIVE: s << "passive"; break; - case Conn::DEAD: s << "dead"; break; } s << ">"; return std::move(s); @@ -244,15 +243,10 @@ void ConnPool::Conn::_recv_data_tls_handshake(const conn_t &conn, int, int) { void ConnPool::Conn::_recv_data_dummy(const conn_t &, int, int) {} void ConnPool::Conn::stop() { - if (mode != ConnMode::DEAD) - { - if (worker) worker->unfeed(); - if (tls) tls->shutdown(); - ev_socket.clear(); - ev_connect.clear(); - send_buffer.get_queue().unreg_handler(); - mode = ConnMode::DEAD; - } + if (worker) worker->unfeed(); + if (tls) tls->shutdown(); + ev_socket.clear(); + send_buffer.get_queue().unreg_handler(); } void ConnPool::worker_terminate(const conn_t &conn) { @@ -414,13 +408,14 @@ void ConnPool::del_conn(const conn_t &conn) { pool.erase(it); update_conn(conn, false); release_conn(conn); + //std::atomic_thread_fence(std::memory_order_release); } void ConnPool::release_conn(const conn_t &conn) { /* inform the upper layer the connection will be destroyed */ + conn->ev_connect.clear(); on_teardown(conn); ::close(conn->fd); - std::atomic_thread_fence(std::memory_order_release); } ConnPool::conn_t ConnPool::add_conn(const conn_t &conn) { |