[PATCH] Fix incr/decr to set proper binary protocol header lengths

Todd Lipcon todd at amiestreet.com
Fri Apr 4 05:15:50 UTC 2008


This fixes binary.t including the extra check previously submitted
for header length discrepancies.
---
  server/memcached.c |    5 ++---
  1 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/server/memcached.c b/server/memcached.c
index 2fb2572..f15eeba 100644
--- a/server/memcached.c
+++ b/server/memcached.c
@@ -1008,7 +1008,7 @@ static void complete_incr_bin(conn *c) {
          add_delta(it, c->cmd == CMD_INCR, delta, tmpbuf);
          *response_buf = swap64(strtoull(tmpbuf, NULL, 10));

-        write_bin_response(c, response_buf, BIN_INCR_HDR_LEN, INCR_RES_LEN);
+        write_bin_response(c, response_buf, 0, INCR_RES_LEN);
          item_remove(it);         /* release our reference */
      } else {
          if(exptime >= 0) {
@@ -1020,8 +1020,7 @@ static void complete_incr_bin(conn *c) {
              snprintf(ITEM_data(it), INCR_MAX_STORAGE_LEN, "%llu", initial);

              if(store_item(it, NREAD_SET)) {
-                write_bin_response(c, response_buf, BIN_INCR_HDR_LEN,
-                    INCR_RES_LEN);
+                write_bin_response(c, response_buf, 0, INCR_RES_LEN);
              } else {
                  write_bin_error(c, ERR_NOT_STORED, 0);
              }
-- 
1.5.3.2



More information about the memcached mailing list