#include "common.h"
+#include "memcached_io.h"
static char *memcached_value_fetch(memcached_st *ptr, char *key, size_t *key_length,
size_t *value_length,
if (*value_length)
{
size_t read_length;
- size_t partial_length;
size_t to_read;
char *value;
char *value_ptr;
value_ptr= value;
read_length= 0;
to_read= (*value_length) + 2;
- /* This is overkill */
- while ((partial_length= recv(ptr->hosts[server_key].fd, value_ptr, to_read, 0)) > 0)
- {
- value_ptr+= partial_length;
- read_length+= partial_length;
- to_read-= partial_length;
- if (read_length == (size_t)(*value_length + 2))
- break;
- }
+
+ read_length= memcached_io_read(ptr, server_key,
+ value_ptr, to_read);
if (read_length != (size_t)(*value_length + 2))
{
}
else
{
- memcached_string_st *string= memcached_string_init(ptr, SMALL_STRING_LEN);
+ memcached_string_st *string= memcached_string_create(ptr, SMALL_STRING_LEN);
/* We need to figure out the correct way to error in case of this failure */
if (!string)