X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;f=libmemcached%2Fmemcached_response.c;h=e9f82b0af3653064e9cec4fa4a8906d1b6128b31;hb=7e0ffed050b62cc5dcf5d16c148185074bfd7d50;hp=e9ff94ac399dbe731a94daee1639d35fb980ce5b;hpb=6dbe9f6cd35e445cf3122d80bd7814370ded2aa0;p=m6w6%2Flibmemcached diff --git a/libmemcached/memcached_response.c b/libmemcached/memcached_response.c index e9ff94ac..e9f82b0a 100644 --- a/libmemcached/memcached_response.c +++ b/libmemcached/memcached_response.c @@ -50,7 +50,8 @@ memcached_return memcached_response(memcached_server_st *ptr, * compatibility. */ if ((ptr->root->flags & MEM_BINARY_PROTOCOL) == 0) - while (memcached_server_response_count(ptr) > 1) { + while (memcached_server_response_count(ptr) > 1) + { memcached_return rc= memcached_read_one_response(ptr, buffer, buffer_length, result); unlikely (rc != MEMCACHED_END && @@ -300,14 +301,30 @@ static memcached_return binary_read_one_response(memcached_server_st *ptr, else if (header.response.bodylen) { /* What should I do with the error message??? just discard it for now */ - char buffer[SMALL_STRING_LEN]; + char hole[SMALL_STRING_LEN]; while (bodylen > 0) { size_t nr= (bodylen > SMALL_STRING_LEN) ? SMALL_STRING_LEN : bodylen; - if (memcached_safe_read(ptr, buffer, nr) != MEMCACHED_SUCCESS) + if (memcached_safe_read(ptr, hole, nr) != MEMCACHED_SUCCESS) return MEMCACHED_UNKNOWN_READ_FAILURE; bodylen -= nr; } + + /* This might be an error from one of the quiet commands.. if + * so, just throw it away and get the next one. What about creating + * a callback to the user with the error information? + */ + switch (header.response.opcode) + { + case PROTOCOL_BINARY_CMD_SETQ: + case PROTOCOL_BINARY_CMD_ADDQ: + case PROTOCOL_BINARY_CMD_REPLACEQ: + case PROTOCOL_BINARY_CMD_APPENDQ: + case PROTOCOL_BINARY_CMD_PREPENDQ: + return binary_read_one_response(ptr, buffer, buffer_length, result); + default: + break; + } } memcached_return rc= MEMCACHED_SUCCESS;