Skip to content

Commit

Permalink
Issue #204, Disable READ/WRITE events if no requests sent (#222)
Browse files Browse the repository at this point in the history
Co-authored-by: YaacovHazan <[email protected]>
  • Loading branch information
YaacovHazan and YaacovHazan authored May 17, 2023
1 parent 8994206 commit 5c8be9c
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions shard_connection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -472,14 +472,6 @@ void shard_connection::process_response(void)

fill_pipeline();

// update events
if (m_bev != NULL) {
// no pending response (nothing to read) and output buffer empty (nothing to write)
if ((m_pending_resp == 0) && (evbuffer_get_length(bufferevent_get_output(m_bev)) == 0)) {
bufferevent_disable(m_bev, EV_WRITE|EV_READ);
}
}

if (m_conns_manager->finished()) {
m_conns_manager->set_end_time();
}
Expand Down Expand Up @@ -508,6 +500,14 @@ void shard_connection::fill_pipeline(void)
// client manage requests logic
m_conns_manager->create_request(now, m_id);
}

// update events
if (m_bev != NULL) {
// no pending response (nothing to read) and output buffer empty (nothing to write)
if ((m_pending_resp == 0) && (evbuffer_get_length(bufferevent_get_output(m_bev)) == 0)) {
bufferevent_disable(m_bev, EV_WRITE|EV_READ);
}
}
}

void shard_connection::handle_event(short events)
Expand Down

0 comments on commit 5c8be9c

Please sign in to comment.