diff options
author | Determinant <[email protected]> | 2019-06-28 22:49:03 -0400 |
---|---|---|
committer | Determinant <[email protected]> | 2019-06-28 22:49:03 -0400 |
commit | 8d242e0112c7f9072600a48366ebbd6ce7b5c727 (patch) | |
tree | a44e9e7c8284f572d29582c4fef8019041d01946 /src | |
parent | ad427b9a7b27e2ae16fc8cb21d612794f4a71955 (diff) |
fix data race in timers
Diffstat (limited to 'src')
-rw-r--r-- | src/conn.cpp | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/src/conn.cpp b/src/conn.cpp index e01690d..b6c6c71 100644 --- a/src/conn.cpp +++ b/src/conn.cpp @@ -248,8 +248,8 @@ void ConnPool::Conn::stop() { { if (worker) worker->unfeed(); if (tls) tls->shutdown(); - ev_connect.del(); - ev_socket.del(); + ev_socket.clear(); + ev_connect.clear(); send_buffer.get_queue().unreg_handler(); mode = ConnMode::DEAD; } @@ -419,9 +419,8 @@ void ConnPool::del_conn(const conn_t &conn) { void ConnPool::release_conn(const conn_t &conn) { /* inform the upper layer the connection will be destroyed */ on_teardown(conn); - conn->ev_connect.clear(); - conn->ev_socket.clear(); ::close(conn->fd); + std::atomic_thread_fence(std::memory_order_release); } ConnPool::conn_t ConnPool::add_conn(const conn_t &conn) { |