@@ -388,26 +388,6 @@ int try_read_command_ascii(conn *c) {
388
388
return 1 ;
389
389
}
390
390
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
-
411
391
static void process_get_command_err (conn * c , const char * errstr ) {
412
392
// Use passed in error or rescue the last error while processing.
413
393
char wbuf [WRITE_BUFFER_SIZE ];
@@ -786,8 +766,6 @@ static void process_update_command(conn *c, mcp_parser_t *pr, mc_resp *resp, int
786
766
static void process_verbosity_command (conn * c , mcp_parser_t * pr ) {
787
767
assert (c != NULL );
788
768
789
- set_noreply_maybe (c , pr );
790
-
791
769
uint32_t level ;
792
770
if (mcmc_token_get_u32 (pr -> request , & pr -> tok , 1 , & level ) != MCMC_OK ) {
793
771
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) {
891
869
892
870
assert (c != NULL );
893
871
894
- set_noreply_maybe (c , pr );
895
-
896
872
const char * subcmd = mcmc_token_get (pr -> request , & pr -> tok , 2 , & len );
897
873
if (strncmp (subcmd , "ratio" , len ) == 0 ) {
898
874
if (ntokens < 4 || !mc_toktod (pr , 3 , & ratio )) {
@@ -1003,8 +979,6 @@ static void process_memlimit_command(conn *c, mcp_parser_t *pr) {
1003
979
uint32_t memlimit ;
1004
980
assert (c != NULL );
1005
981
1006
- set_noreply_maybe (c , pr );
1007
-
1008
982
if (mcmc_token_get_u32 (pr -> request , & pr -> tok , 1 , & memlimit ) != MCMC_OK ) {
1009
983
out_string (c , "ERROR" );
1010
984
} else {
@@ -1036,8 +1010,6 @@ static void process_lru_command(conn *c, mcp_parser_t *pr) {
1036
1010
int ntokens = pr -> tok .ntokens ;
1037
1011
const char * subcmd = mcmc_token_get (pr -> request , & pr -> tok , SUBCOMMAND_TOKEN , & len );
1038
1012
1039
- set_noreply_maybe (c , pr );
1040
-
1041
1013
if (strncmp (subcmd , "tune" , len ) == 0 && ntokens >= 6 ) {
1042
1014
if (!mc_toktou32 (pr , 2 , & pct_hot ) ||
1043
1015
!mc_toktou32 (pr , 3 , & pct_warm ) ||
@@ -1087,7 +1059,6 @@ static void process_lru_command(conn *c, mcp_parser_t *pr) {
1087
1059
}
1088
1060
#ifdef EXTSTORE
1089
1061
static void process_extstore_command (conn * c , mcp_parser_t * pr ) {
1090
- set_noreply_maybe (c , pr );
1091
1062
bool ok = true;
1092
1063
int ntokens = pr -> tok .ntokens ;
1093
1064
int len = 0 ;
@@ -1157,8 +1128,6 @@ static void process_flush_all_command(conn *c, mcp_parser_t *pr) {
1157
1128
int32_t exptime = 0 ;
1158
1129
rel_time_t new_oldest = 0 ;
1159
1130
1160
- set_noreply_maybe (c , pr );
1161
-
1162
1131
pthread_mutex_lock (& c -> thread -> stats .mutex );
1163
1132
c -> thread -> stats .flush_cmds ++ ;
1164
1133
pthread_mutex_unlock (& c -> thread -> stats .mutex );
@@ -1436,7 +1405,6 @@ static void process_lru_crawler_command(conn *c, mcp_parser_t *pr) {
1436
1405
}
1437
1406
#ifdef TLS
1438
1407
static void process_refresh_certs_command (conn * c , mcp_parser_t * pr ) {
1439
- set_noreply_maybe (c , pr );
1440
1408
char * errmsg = NULL ;
1441
1409
if (refresh_certs (& errmsg )) {
1442
1410
out_string (c , "OK" );
@@ -1522,6 +1490,7 @@ void process_command_ascii(conn *c, char *command, size_t cmdlen) {
1522
1490
1523
1491
t -> cur_sfd = c -> sfd ; // cuddle sfd for logging.
1524
1492
int ret = process_request (& pr , command , cmdlen );
1493
+ c -> resp -> noreply = pr .noreply ;
1525
1494
if (settings .verbose > 1 ) {
1526
1495
fprintf (stderr , "<%d %.*s\n" , t -> cur_sfd , (int )cmdlen - 2 , command );
1527
1496
}
0 commit comments