Skip to content

Commit

Permalink
CLEANUP: Refactored the conn_new_cmd() function.
Browse files Browse the repository at this point in the history
  • Loading branch information
jhpark816 committed Dec 13, 2024
1 parent ebb0584 commit 199dd9f
Showing 1 changed file with 17 additions and 19 deletions.
36 changes: 17 additions & 19 deletions memcached.c
Original file line number Diff line number Diff line change
Expand Up @@ -13669,7 +13669,6 @@ bool conn_read(conn *c)
/* State already set by try_read_network */
break;
}

return true;
}

Expand Down Expand Up @@ -13701,26 +13700,25 @@ bool conn_new_cmd(conn *c)
--c->nevents;
if (c->nevents >= 0) {
reset_cmd_handler(c);
} else {
STATS_ADD(c, conn_yields, 1);
if (c->rbytes > 0) {
/* We have already read in data into the input buffer,
so libevent will most likely not signal read events
on the socket (unless more data is available. As a
hack we should just put in a request to write data,
because that should be possible ;-)
*/
if (!update_event(c, EV_WRITE | EV_PERSIST)) {
mc_logger->log(EXTENSION_LOG_WARNING, c,
"Couldn't update event in conn_new_cmd.\n");
conn_set_state(c, conn_closing);
return true;
}
}
return false;
return true;
}

return true;
STATS_ADD(c, conn_yields, 1);
if (c->rbytes > 0) {
/* We have already read in data into the input buffer,
so libevent will most likely not signal read events
on the socket (unless more data is available. As a
hack we should just put in a request to write data,
because that should be possible ;-)
*/
if (!update_event(c, EV_WRITE | EV_PERSIST)) {
mc_logger->log(EXTENSION_LOG_WARNING, c,
"Couldn't update event in conn_new_cmd.\n");
conn_set_state(c, conn_closing);
return true;
}
}
return false;
}

bool conn_swallow(conn *c)
Expand Down

0 comments on commit 199dd9f

Please sign in to comment.