diff --git a/shard_connection.cpp b/shard_connection.cpp index 0c8a54b..e873308 100644 --- a/shard_connection.cpp +++ b/shard_connection.cpp @@ -129,7 +129,7 @@ verify_request::~verify_request(void) shard_connection::shard_connection(unsigned int id, connections_manager* conns_man, benchmark_config* config, struct event_base* event_base, abstract_protocol* abs_protocol) : m_address(NULL), m_port(NULL), m_unix_sockaddr(NULL), - m_bev(NULL), m_request_per_cur_interval(0), m_pending_resp(0), m_connection_state(conn_disconnected), + m_bev(NULL), m_event_timer(NULL), m_request_per_cur_interval(0), m_pending_resp(0), m_connection_state(conn_disconnected), m_hello(setup_done), m_authentication(setup_done), m_db_selection(setup_done), m_cluster_slots(setup_done) { m_id = id; m_conns_manager = conns_man; @@ -174,6 +174,11 @@ shard_connection::~shard_connection() { m_bev = NULL; } + if (m_event_timer != NULL) { + event_free(m_event_timer); + m_event_timer = NULL; + } + if (m_protocol != NULL) { delete m_protocol; m_protocol = NULL; @@ -298,8 +303,13 @@ int shard_connection::connect(struct connect_info* addr) { void shard_connection::disconnect() { if (m_bev) { bufferevent_free(m_bev); + m_bev = NULL; + } + + if (m_event_timer != NULL) { + event_free(m_event_timer); + m_event_timer = NULL; } - m_bev = NULL; // empty pipeline while (m_pending_resp)