Skip to content

Commit 5c8be9c

Browse files
authored
Issue #204, Disable READ/WRITE events if no requests sent (#222)
Co-authored-by: YaacovHazan <[email protected]>
1 parent 8994206 commit 5c8be9c

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

shard_connection.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -472,14 +472,6 @@ void shard_connection::process_response(void)
472472

473473
fill_pipeline();
474474

475-
// update events
476-
if (m_bev != NULL) {
477-
// no pending response (nothing to read) and output buffer empty (nothing to write)
478-
if ((m_pending_resp == 0) && (evbuffer_get_length(bufferevent_get_output(m_bev)) == 0)) {
479-
bufferevent_disable(m_bev, EV_WRITE|EV_READ);
480-
}
481-
}
482-
483475
if (m_conns_manager->finished()) {
484476
m_conns_manager->set_end_time();
485477
}
@@ -508,6 +500,14 @@ void shard_connection::fill_pipeline(void)
508500
// client manage requests logic
509501
m_conns_manager->create_request(now, m_id);
510502
}
503+
504+
// update events
505+
if (m_bev != NULL) {
506+
// no pending response (nothing to read) and output buffer empty (nothing to write)
507+
if ((m_pending_resp == 0) && (evbuffer_get_length(bufferevent_get_output(m_bev)) == 0)) {
508+
bufferevent_disable(m_bev, EV_WRITE|EV_READ);
509+
}
510+
}
511511
}
512512

513513
void shard_connection::handle_event(short events)

0 commit comments

Comments
 (0)