projects
/
awesomized
/
libmemcached
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
|
github
raw
|
inline
| side by side
Updated for custom hash functions/setting functions.
[awesomized/libmemcached]
/
libmemcached
/
response.c
diff --git
a/libmemcached/response.c
b/libmemcached/response.c
index 37a06f44dda10268f647fc54135f2eaa5486c545..3784438ede3a54dc5c8cfedfb22809c7aa82252a 100644
(file)
--- a/
libmemcached/response.c
+++ b/
libmemcached/response.c
@@
-25,7
+25,10
@@
memcached_return_t memcached_read_one_response(memcached_server_instance_st *ptr
memcached_server_response_decrement(ptr);
if (result == NULL)
memcached_server_response_decrement(ptr);
if (result == NULL)
- result = &ptr->root->result;
+ {
+ memcached_st *root= (memcached_st *)ptr->root;
+ result = &root->result;
+ }
memcached_return_t rc;
if (ptr->root->flags.binary_protocol)
memcached_return_t rc;
if (ptr->root->flags.binary_protocol)
@@
-47,8
+50,10
@@
memcached_return_t memcached_response(memcached_server_instance_st *ptr,
memcached_result_st *result)
{
/* We may have old commands in the buffer not set, first purge */
memcached_result_st *result)
{
/* We may have old commands in the buffer not set, first purge */
- if (ptr->root->flags.no_block)
+ if ((ptr->root->flags.no_block) && (memcached_is_processing_input(ptr->root) == false))
+ {
(void)memcached_io_write(ptr, NULL, 0, 1);
(void)memcached_io_write(ptr, NULL, 0, 1);
+ }
/*
* The previous implementation purged all pending requests and just
/*
* The previous implementation purged all pending requests and just
@@
-105,7
+110,7
@@
static memcached_return_t textual_value_fetch(memcached_server_instance_st *ptr,
char *key;
size_t prefix_length;
char *key;
size_t prefix_length;
- key= result->key;
+ key= result->
item_
key;
result->key_length= 0;
for (prefix_length= ptr->root->prefix_key_length; !(iscntrl(*string_ptr) || isspace(*string_ptr)) ; string_ptr++)
result->key_length= 0;
for (prefix_length= ptr->root->prefix_key_length; !(iscntrl(*string_ptr) || isspace(*string_ptr)) ; string_ptr++)
@@
-119,7
+124,7
@@
static memcached_return_t textual_value_fetch(memcached_server_instance_st *ptr,
else
prefix_length--;
}
else
prefix_length--;
}
- result->key[result->key_length]= 0;
+ result->
item_
key[result->key_length]= 0;
}
if (end_ptr == string_ptr)
}
if (end_ptr == string_ptr)
@@
-130,7
+135,7
@@
static memcached_return_t textual_value_fetch(memcached_server_instance_st *ptr,
if (end_ptr == string_ptr)
goto read_error;
for (next_ptr= string_ptr; isdigit(*string_ptr); string_ptr++);
if (end_ptr == string_ptr)
goto read_error;
for (next_ptr= string_ptr; isdigit(*string_ptr); string_ptr++);
- result->flags= (uint32_t) strtoul(next_ptr, &string_ptr, 10);
+ result->
item_
flags= (uint32_t) strtoul(next_ptr, &string_ptr, 10);
if (end_ptr == string_ptr)
goto read_error;
if (end_ptr == string_ptr)
goto read_error;
@@
-156,7
+161,7
@@
static memcached_return_t textual_value_fetch(memcached_server_instance_st *ptr,
{
string_ptr++;
for (next_ptr= string_ptr; isdigit(*string_ptr); string_ptr++);
{
string_ptr++;
for (next_ptr= string_ptr; isdigit(*string_ptr); string_ptr++);
- result->cas= strtoull(next_ptr, &string_ptr, 10);
+ result->
item_
cas= strtoull(next_ptr, &string_ptr, 10);
}
if (end_ptr < string_ptr)
}
if (end_ptr < string_ptr)
@@
-170,7
+175,7
@@
static memcached_return_t textual_value_fetch(memcached_server_instance_st *ptr,
return MEMCACHED_MEMORY_ALLOCATION_FAILURE;
}
return MEMCACHED_MEMORY_ALLOCATION_FAILURE;
}
- value_ptr= memcached_string_value(&result->value);
+ value_ptr= memcached_string_value
_mutable
(&result->value);
/*
We read the \r\n into the string since not doing so is more
cycles then the waster of memory to do so.
/*
We read the \r\n into the string since not doing so is more
cycles then the waster of memory to do so.
@@
-191,7
+196,7
@@
static memcached_return_t textual_value_fetch(memcached_server_instance_st *ptr,
/* This next bit blows the API, but this is internal....*/
{
char *char_ptr;
/* This next bit blows the API, but this is internal....*/
{
char *char_ptr;
- char_ptr= memcached_string_value(&result->value);;
+ char_ptr= memcached_string_value
_mutable
(&result->value);;
char_ptr[value_length]= 0;
char_ptr[value_length + 1]= 0;
memcached_string_set_length(&result->value, value_length);
char_ptr[value_length]= 0;
char_ptr[value_length + 1]= 0;
memcached_string_set_length(&result->value, value_length);
@@
-254,9
+259,9
@@
static memcached_return_t textual_read_one_response(memcached_server_instance_st
memory in the struct, which is important, for something that
rarely should happen?
*/
memory in the struct, which is important, for something that
rarely should happen?
*/
- rel_ptr= (char *)
ptr->root->call_realloc(ptr->root,
-
ptr->cached_server_error,
-
(size_t) (endptr - startptr + 1));
+ rel_ptr= (char *)
libmemcached_realloc(ptr->root,
+ ptr->cached_server_error,
+ (size_t) (endptr - startptr + 1));
if (rel_ptr == NULL)
{
if (rel_ptr == NULL)
{
@@
-359,17
+364,17
@@
static memcached_return_t binary_read_one_response(memcached_server_instance_st
{
uint16_t keylen= header.response.keylen;
memcached_result_reset(result);
{
uint16_t keylen= header.response.keylen;
memcached_result_reset(result);
- result->cas= header.response.cas;
+ result->
item_
cas= header.response.cas;
- if (memcached_safe_read(ptr, &result->flags,
- sizeof (result->flags)) != MEMCACHED_SUCCESS)
+ if (memcached_safe_read(ptr, &result->
item_
flags,
+ sizeof (result->
item_
flags)) != MEMCACHED_SUCCESS)
return MEMCACHED_UNKNOWN_READ_FAILURE;
return MEMCACHED_UNKNOWN_READ_FAILURE;
- result->
flags= ntohl(result->
flags);
+ result->
item_flags= ntohl(result->item_
flags);
bodylen -= header.response.extlen;
result->key_length= keylen;
bodylen -= header.response.extlen;
result->key_length= keylen;
- if (memcached_safe_read(ptr, result->key, keylen) != MEMCACHED_SUCCESS)
+ if (memcached_safe_read(ptr, result->
item_
key, keylen) != MEMCACHED_SUCCESS)
return MEMCACHED_UNKNOWN_READ_FAILURE;
bodylen -= keylen;
return MEMCACHED_UNKNOWN_READ_FAILURE;
bodylen -= keylen;
@@
-377,7
+382,7
@@
static memcached_return_t binary_read_one_response(memcached_server_instance_st
bodylen) != MEMCACHED_SUCCESS)
return MEMCACHED_MEMORY_ALLOCATION_FAILURE;
bodylen) != MEMCACHED_SUCCESS)
return MEMCACHED_MEMORY_ALLOCATION_FAILURE;
- char *vptr= memcached_string_value(&result->value);
+ char *vptr= memcached_string_value
_mutable
(&result->value);
if (memcached_safe_read(ptr, vptr, bodylen) != MEMCACHED_SUCCESS)
return MEMCACHED_UNKNOWN_READ_FAILURE;
if (memcached_safe_read(ptr, vptr, bodylen) != MEMCACHED_SUCCESS)
return MEMCACHED_UNKNOWN_READ_FAILURE;