diff options
author | Determinant <[email protected]> | 2018-11-14 23:14:32 -0500 |
---|---|---|
committer | Determinant <[email protected]> | 2018-11-14 23:14:32 -0500 |
commit | 5f88ebb43acc7b7fa3ac272a444677dd72ccb63d (patch) | |
tree | c0075433e52d923609a7587bd25a66e1bcf78867 /src | |
parent | ecc163f98e434b557768560d00ee2f9755d6d950 (diff) |
fix bugs in `terminate`
Diffstat (limited to 'src')
-rw-r--r-- | src/conn.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
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(); |