Take two at getting this through to the list... email on my laptop seems uncooperative.

=========

Tests: binary.t still passes. Should probably add binary.t test which exposes 
earlier bug.
---
 server/memcached.c |   15 ++++++++++++++-
 1 files changed, 14 insertions(+), 1 deletions(-)

diff --git a/server/memcached.c b/server/memcached.c
index b8d4968..2fb2572 100644
--- a/server/memcached.c
+++ b/server/memcached.c
@@ -1037,6 +1037,8 @@ static void complete_update_bin(conn *c) {
     assert(c != NULL);

     item *it = c->item;
+    uint64_t *identifier;
+    uint8_t *response_buf = c->wbuf + MIN_BIN_PKT_LENGTH;

     STATS_LOCK();
     stats.set_cmds++;
@@ -1050,7 +1052,18 @@ static void complete_update_bin(conn *c) {
     switch (store_item(it, c->item_comm)) {
         case 1:
             /* Stored */
-            write_bin_response(c, NULL, BIN_SET_HDR_LEN, 0);
+            add_bin_header(c, 0, BIN_SET_HDR_LEN, BIN_SET_HDR_LEN);
+
+            /* copy requested flags and expiration */
+            memcpy(response_buf + 8, c->rbuf + 8, BIN_SET_HDR_LEN - 8);
+
+            /* replace cas with new cas */
+            identifier = (uint64_t *)(response_buf);
+            *identifier = swap64(it->cas_id);
+
+            add_iov(c, response_buf, BIN_SET_HDR_LEN);
+            conn_set_state(c, conn_mwrite);
+            c->write_and_go = conn_new_cmd;
             break;
         case 2:
             write_bin_error(c, ERR_EXISTS, 0);
--
1.5.3.2

Reply via email to