diff --git a/cproxy.c b/cproxy.c index 9015c656..9217a413 100644 --- a/cproxy.c +++ b/cproxy.c @@ -325,14 +325,13 @@ void cproxy_on_close_downstream_conn(conn *c) { // ending up here. That is, drive_machine only // seems to move to conn_closing from conn_read. // - // TODO: Need a retry counter on the upstream conn? - // if (c->rcurr != NULL && c->rbytes == 0 && d->downstream_used_start == d->downstream_used && - d->downstream_used_start == 1) { + d->downstream_used_start == 1 && + d->upstream_conn->cmd_retries < 1) { + d->upstream_conn->cmd_retries++; uc_retry = d->upstream_conn; - d->upstream_suffix = NULL; } } diff --git a/cproxy_protocol.c b/cproxy_protocol.c index 62753bbb..886ac22d 100644 --- a/cproxy_protocol.c +++ b/cproxy_protocol.c @@ -35,6 +35,7 @@ void cproxy_process_upstream_ascii(conn *c, char *line) { // Snapshot rcurr, because the caller, try_read_command(), changes it. // c->cmd_ascii = c->rcurr; + c->cmd_retries = 0; /* For commands set/add/replace, we build an item and read the data * directly into it, then continue in nread_complete(). diff --git a/memcached.h b/memcached.h index 5db354c3..637f59c0 100644 --- a/memcached.h +++ b/memcached.h @@ -413,8 +413,10 @@ struct conn { LIBEVENT_THREAD *thread; /* Pointer to the thread object serving this connection */ conn_funcs *funcs; - char *cmd_ascii; // Pointer into rbuf, snapshot of rcurr. void *extra; + + char *cmd_ascii; // Pointer into rbuf, snapshot of rcurr. + int cmd_retries; }; extern conn *listen_conn;