aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDeterminant <[email protected]>2018-11-14 23:14:32 -0500
committerDeterminant <[email protected]>2018-11-14 23:14:32 -0500
commit5f88ebb43acc7b7fa3ac272a444677dd72ccb63d (patch)
treec0075433e52d923609a7587bd25a66e1bcf78867 /src
parentecc163f98e434b557768560d00ee2f9755d6d950 (diff)
fix bugs in `terminate`
Diffstat (limited to 'src')
-rw-r--r--src/conn.cpp5
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();