diff options
Diffstat (limited to 'memcached.c')
-rw-r--r-- | memcached.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/memcached.c b/memcached.c index d1be82f..2678b64 100644 --- a/memcached.c +++ b/memcached.c @@ -2310,7 +2310,7 @@ enum store_item_type do_store_item(item *it, int comm, conn *c, const uint32_t h flags = (int) strtol(ITEM_suffix(old_it), (char **) NULL, 10); - new_it = do_item_alloc(key, it->nkey, flags, old_it->exptime, it->nbytes + old_it->nbytes - 2 /* CRLF */); + new_it = item_alloc(key, it->nkey, flags, old_it->exptime, it->nbytes + old_it->nbytes - 2 /* CRLF */); if (new_it == NULL) { /* SERVER_ERROR out of memory */ @@ -3080,7 +3080,7 @@ enum delta_result_type do_add_delta(conn *c, const char *key, const size_t nkey, res = strlen(buf); if (res + 2 > it->nbytes || it->refcount != 1) { /* need to realloc */ item *new_it; - new_it = do_item_alloc(ITEM_key(it), it->nkey, atoi(ITEM_suffix(it) + 1), it->exptime, res + 2 ); + new_it = item_alloc(ITEM_key(it), it->nkey, atoi(ITEM_suffix(it) + 1), it->exptime, res + 2 ); if (new_it == 0) { do_item_remove(it); return EOM; @@ -3095,7 +3095,9 @@ enum delta_result_type do_add_delta(conn *c, const char *key, const size_t nkey, } else { /* replace in-place */ /* When changing the value without replacing the item, we need to update the CAS on the existing item. */ + mutex_lock(&cache_lock); /* FIXME */ ITEM_set_cas(it, (settings.use_cas) ? get_cas_id() : 0); + pthread_mutex_unlock(&cache_lock); memcpy(ITEM_data(it), buf, res); memset(ITEM_data(it) + res, ' ', it->nbytes - res - 2); |