@@ -388,26 +388,6 @@ int try_read_command_ascii(conn *c) {
388388 return 1 ;
389389}
390390
391- static inline bool set_noreply_maybe (conn * c , mcp_parser_t * pr ) {
392- int noreply_index = pr -> tok .ntokens - 1 ;
393-
394- /*
395- NOTE: this function is not the first place where we are going to
396- send the reply. We could send it instead from process_command()
397- if the request line has wrong number of tokens. However parsing
398- malformed line for "noreply" option is not reliable anyway, so
399- it can't be helped.
400- */
401- if (noreply_index >= 0 ) {
402- int len = 0 ;
403- const char * noreply = mcmc_token_get (pr -> request , & pr -> tok , noreply_index , & len );
404- if (strncmp (noreply , "noreply" , 7 ) == 0 ) {
405- c -> resp -> noreply = true;
406- }
407- }
408- return c -> resp -> noreply ;
409- }
410-
411391static void process_get_command_err (conn * c , const char * errstr ) {
412392 // Use passed in error or rescue the last error while processing.
413393 char wbuf [WRITE_BUFFER_SIZE ];
@@ -786,8 +766,6 @@ static void process_update_command(conn *c, mcp_parser_t *pr, mc_resp *resp, int
786766static void process_verbosity_command (conn * c , mcp_parser_t * pr ) {
787767 assert (c != NULL );
788768
789- set_noreply_maybe (c , pr );
790-
791769 uint32_t level ;
792770 if (mcmc_token_get_u32 (pr -> request , & pr -> tok , 1 , & level ) != MCMC_OK ) {
793771 out_string (c , "CLIENT_ERROR bad command line format" );
@@ -891,8 +869,6 @@ static void process_slabs_automove_command(conn *c, mcp_parser_t *pr) {
891869
892870 assert (c != NULL );
893871
894- set_noreply_maybe (c , pr );
895-
896872 const char * subcmd = mcmc_token_get (pr -> request , & pr -> tok , 2 , & len );
897873 if (strncmp (subcmd , "ratio" , len ) == 0 ) {
898874 if (ntokens < 4 || !mc_toktod (pr , 3 , & ratio )) {
@@ -1003,8 +979,6 @@ static void process_memlimit_command(conn *c, mcp_parser_t *pr) {
1003979 uint32_t memlimit ;
1004980 assert (c != NULL );
1005981
1006- set_noreply_maybe (c , pr );
1007-
1008982 if (mcmc_token_get_u32 (pr -> request , & pr -> tok , 1 , & memlimit ) != MCMC_OK ) {
1009983 out_string (c , "ERROR" );
1010984 } else {
@@ -1036,8 +1010,6 @@ static void process_lru_command(conn *c, mcp_parser_t *pr) {
10361010 int ntokens = pr -> tok .ntokens ;
10371011 const char * subcmd = mcmc_token_get (pr -> request , & pr -> tok , SUBCOMMAND_TOKEN , & len );
10381012
1039- set_noreply_maybe (c , pr );
1040-
10411013 if (strncmp (subcmd , "tune" , len ) == 0 && ntokens >= 6 ) {
10421014 if (!mc_toktou32 (pr , 2 , & pct_hot ) ||
10431015 !mc_toktou32 (pr , 3 , & pct_warm ) ||
@@ -1087,7 +1059,6 @@ static void process_lru_command(conn *c, mcp_parser_t *pr) {
10871059}
10881060#ifdef EXTSTORE
10891061static void process_extstore_command (conn * c , mcp_parser_t * pr ) {
1090- set_noreply_maybe (c , pr );
10911062 bool ok = true;
10921063 int ntokens = pr -> tok .ntokens ;
10931064 int len = 0 ;
@@ -1157,8 +1128,6 @@ static void process_flush_all_command(conn *c, mcp_parser_t *pr) {
11571128 int32_t exptime = 0 ;
11581129 rel_time_t new_oldest = 0 ;
11591130
1160- set_noreply_maybe (c , pr );
1161-
11621131 pthread_mutex_lock (& c -> thread -> stats .mutex );
11631132 c -> thread -> stats .flush_cmds ++ ;
11641133 pthread_mutex_unlock (& c -> thread -> stats .mutex );
@@ -1436,7 +1405,6 @@ static void process_lru_crawler_command(conn *c, mcp_parser_t *pr) {
14361405}
14371406#ifdef TLS
14381407static void process_refresh_certs_command (conn * c , mcp_parser_t * pr ) {
1439- set_noreply_maybe (c , pr );
14401408 char * errmsg = NULL ;
14411409 if (refresh_certs (& errmsg )) {
14421410 out_string (c , "OK" );
@@ -1522,6 +1490,7 @@ void process_command_ascii(conn *c, char *command, size_t cmdlen) {
15221490
15231491 t -> cur_sfd = c -> sfd ; // cuddle sfd for logging.
15241492 int ret = process_request (& pr , command , cmdlen );
1493+ c -> resp -> noreply = pr .noreply ;
15251494 if (settings .verbose > 1 ) {
15261495 fprintf (stderr , "<%d %.*s\n" , t -> cur_sfd , (int )cmdlen - 2 , command );
15271496 }
0 commit comments