From b98265d732bad274f66de66cb93d891e9c41a112 Mon Sep 17 00:00:00 2001 From: Determinant Date: Thu, 12 Jul 2018 20:25:41 -0400 Subject: fix bugs --- src/conn.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/conn.cpp b/src/conn.cpp index 2bcd0ae..0b42853 100644 --- a/src/conn.cpp +++ b/src/conn.cpp @@ -136,7 +136,7 @@ void ConnPool::accept_client(evutil_socket_t fd, short) { NetAddr addr((struct sockaddr_in *)&client_addr); conn_t conn = create_conn(); - Conn *conn_ptr = conn; + Conn *conn_ptr = conn.get(); conn->fd = client_fd; conn->cpool = this; conn->mode = Conn::PASSIVE; @@ -165,7 +165,7 @@ void ConnPool::Conn::conn_server(evutil_socket_t fd, short events) { std::bind(&Conn::send_data, this, _1, _2)); ev_read.add(); ev_write.add(); - ev_connect.del(); + ev_connect.clear(); ready_send = false; SALTICIDAE_LOG_INFO("connected to peer %s", std::string(*this).c_str()); on_setup(); @@ -212,7 +212,7 @@ void ConnPool::Conn::terminate() { { /* temporarily pin the conn before it dies */ auto conn = it->second; - assert(conn == this); + assert(conn.get() == this); pool.erase(it); close(); /* inform the upper layer the connection will be destroyed */ @@ -252,7 +252,7 @@ ConnPool::conn_t ConnPool::create_conn(const NetAddr &addr) { if (fcntl(fd, F_SETFL, O_NONBLOCK) == -1) throw ConnPoolError(std::string("unable to set nonblocking socket")); conn_t conn = create_conn(); - Conn * conn_ptr = conn; + Conn * conn_ptr = conn.get(); conn->fd = fd; conn->cpool = this; conn->mode = Conn::ACTIVE; -- cgit v1.2.3-70-g09d2