From 5f88ebb43acc7b7fa3ac272a444677dd72ccb63d Mon Sep 17 00:00:00 2001 From: Determinant Date: Wed, 14 Nov 2018 23:14:32 -0500 Subject: fix bugs in `terminate` --- src/conn.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/conn.cpp b/src/conn.cpp index da8086c..f170d0a 100644 --- a/src/conn.cpp +++ b/src/conn.cpp @@ -173,7 +173,7 @@ void ConnPool::Conn::conn_server(int fd, int events) { { if (events & Event::TIMEOUT) SALTICIDAE_LOG_INFO("%s connect timeout", std::string(*this).c_str()); - stop(); + cpool->terminate(conn); return; } } @@ -237,7 +237,7 @@ ConnPool::conn_t ConnPool::_connect(const NetAddr &addr) { sizeof(struct sockaddr_in)) < 0 && errno != EINPROGRESS) { SALTICIDAE_LOG_INFO("cannot connect to %s", std::string(addr).c_str()); - conn->stop(); + terminate(conn); } else { @@ -256,6 +256,7 @@ void ConnPool::remove_conn(int fd) { /* temporarily pin the conn before it dies */ auto conn = it->second; //assert(conn->fd == fd); + conn->fd = -1; pool.erase(it); /* inform the upper layer the connection will be destroyed */ conn->on_teardown(); -- cgit v1.2.3-70-g09d2