From: Brian Aker Date: Sat, 18 Feb 2012 16:55:19 +0000 (-0800) Subject: Update error type X-Git-Tag: 1.0.5~33 X-Git-Url: https://git.m6w6.name/?a=commitdiff_plain;h=81655759c1b673655289d977b2b755c3c9ec4f74;p=m6w6%2Flibmemcached Update error type --- diff --git a/libmemcached/io.cc b/libmemcached/io.cc index ab9c9b92..049c436d 100644 --- a/libmemcached/io.cc +++ b/libmemcached/io.cc @@ -192,8 +192,7 @@ static memcached_return_t io_wait(memcached_server_write_instance_st ptr, */ if (read_or_write == MEM_WRITE) { - memcached_return_t rc= memcached_purge(ptr); - if (memcached_fatal(rc)) + if (memcached_fatal(memcached_purge(ptr))) { return MEMCACHED_FAILURE; } diff --git a/libmemcached/purge.cc b/libmemcached/purge.cc index 4dd65419..6142e5fb 100644 --- a/libmemcached/purge.cc +++ b/libmemcached/purge.cc @@ -116,8 +116,7 @@ memcached_return_t memcached_purge(memcached_server_write_instance_st ptr) { for (uint32_t y= 0; y < cb.number_of_callback; y++) { - rc = (*cb.callback[y])(ptr->root, result_ptr, cb.context); - if (rc != MEMCACHED_SUCCESS) + if (memcached_fatal((*cb.callback[y])(ptr->root, result_ptr, cb.context))) { break; } diff --git a/libmemcached/response.cc b/libmemcached/response.cc index 511cf786..ff517e31 100644 --- a/libmemcached/response.cc +++ b/libmemcached/response.cc @@ -212,7 +212,7 @@ static memcached_return_t textual_read_one_response(memcached_server_write_insta if (version == LONG_MIN or version == LONG_MAX or errno == EINVAL or version > UINT8_MAX or version == 0) { instance->major_version= instance->minor_version= instance->micro_version= UINT8_MAX; - return memcached_set_error(*instance, MEMCACHED_PROTOCOL_ERROR, MEMCACHED_AT, memcached_literal_param("strtol() failed to parse major version")); + return memcached_set_error(*instance, MEMCACHED_UNKNOWN_READ_FAILURE, MEMCACHED_AT, memcached_literal_param("strtol() failed to parse major version")); } instance->major_version= uint8_t(version); @@ -223,7 +223,7 @@ static memcached_return_t textual_read_one_response(memcached_server_write_insta if (version == LONG_MIN or version == LONG_MAX or errno == EINVAL or version > UINT8_MAX) { instance->major_version= instance->minor_version= instance->micro_version= UINT8_MAX; - return memcached_set_error(*instance, MEMCACHED_PROTOCOL_ERROR, MEMCACHED_AT, memcached_literal_param("strtol() failed to parse minor version")); + return memcached_set_error(*instance, MEMCACHED_UNKNOWN_READ_FAILURE, MEMCACHED_AT, memcached_literal_param("strtol() failed to parse minor version")); } instance->minor_version= uint8_t(version); @@ -234,7 +234,7 @@ static memcached_return_t textual_read_one_response(memcached_server_write_insta if (version == LONG_MIN or version == LONG_MAX or errno == EINVAL or version > UINT8_MAX) { instance->major_version= instance->minor_version= instance->micro_version= UINT8_MAX; - return memcached_set_error(*instance, MEMCACHED_PROTOCOL_ERROR, MEMCACHED_AT, memcached_literal_param("strtol() failed to parse micro version")); + return memcached_set_error(*instance, MEMCACHED_UNKNOWN_READ_FAILURE, MEMCACHED_AT, memcached_literal_param("strtol() failed to parse micro version")); } instance->micro_version= uint8_t(version); @@ -573,7 +573,7 @@ static memcached_return_t binary_read_one_response(memcached_server_write_instan if (version == LONG_MIN or version == LONG_MAX or errno == EINVAL or version > UINT8_MAX or version == 0) { instance->major_version= instance->minor_version= instance->micro_version= UINT8_MAX; - return memcached_set_error(*instance, MEMCACHED_PROTOCOL_ERROR, MEMCACHED_AT, memcached_literal_param("strtol() failed to parse major version")); + return memcached_set_error(*instance, MEMCACHED_UNKNOWN_READ_FAILURE, MEMCACHED_AT, memcached_literal_param("strtol() failed to parse major version")); } instance->major_version= uint8_t(version); @@ -581,7 +581,7 @@ static memcached_return_t binary_read_one_response(memcached_server_write_instan if (version == LONG_MIN or version == LONG_MAX or errno == EINVAL or version > UINT8_MAX) { instance->major_version= instance->minor_version= instance->micro_version= UINT8_MAX; - return memcached_set_error(*instance, MEMCACHED_PROTOCOL_ERROR, MEMCACHED_AT, memcached_literal_param("strtol() failed to parse micro version")); + return memcached_set_error(*instance, MEMCACHED_UNKNOWN_READ_FAILURE, MEMCACHED_AT, memcached_literal_param("strtol() failed to parse micro version")); } instance->minor_version= uint8_t(version); @@ -589,7 +589,7 @@ static memcached_return_t binary_read_one_response(memcached_server_write_instan if (errno == ERANGE) { instance->major_version= instance->minor_version= instance->micro_version= UINT8_MAX; - return memcached_set_error(*instance, MEMCACHED_PROTOCOL_ERROR, MEMCACHED_AT, memcached_literal_param("strtol() failed to parse micro version")); + return memcached_set_error(*instance, MEMCACHED_UNKNOWN_READ_FAILURE, MEMCACHED_AT, memcached_literal_param("strtol() failed to parse micro version")); } instance->micro_version= uint8_t(version); } @@ -764,7 +764,6 @@ static memcached_return_t _read_one_response(memcached_server_write_instance_st else { rc= textual_read_one_response(instance, buffer, buffer_length, result); - assert(rc != MEMCACHED_PROTOCOL_ERROR); } if (memcached_fatal(rc))