From 54f5abf3d4dac9cdf04846d5b952799c31753c9d Mon Sep 17 00:00:00 2001 From: Determinant Date: Sat, 29 Jun 2019 14:13:59 -0400 Subject: ... --- src/conn.cpp | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) (limited to 'src') 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) { -- cgit v1.2.3-70-g09d2