from an issued command.
*/
-#include <memcached.h>
+#include "common.h"
+#include "memcached_io.h"
memcached_return memcached_response(memcached_st *ptr,
char *buffer, size_t buffer_length,
while (1)
{
unsigned int read_length;
- read_length= read(ptr->hosts[server_key].fd, buffer_ptr, 1);
+
+ read_length= memcached_io_read(ptr, server_key,
+ buffer_ptr, 1);
if (read_length != 1)
return MEMCACHED_UNKNOWN_READ_FAILURE;
return MEMCACHED_SUCCESS;
case 'S': /* STORED STATS SERVER_ERROR */
{
- if (buffer[1] == 'T') /* STORED STATS */
+ if (buffer[2] == 'A') /* STORED STATS */
return MEMCACHED_SUCCESS;
else if (buffer[1] == 'E')
return MEMCACHED_SERVER_ERROR;
+ else if (buffer[1] == 'T')
+ return MEMCACHED_STORED;
else
return MEMCACHED_UNKNOWN_READ_FAILURE;
}
case 'D': /* DELETED */
- return MEMCACHED_SUCCESS;
+ return MEMCACHED_DELETED;
case 'N': /* NOT_FOUND */
{
if (buffer[4] == 'F')
case 'E': /* PROTOCOL ERROR or END */
{
if (buffer[1] == 'N')
- return MEMCACHED_NOTFOUND;
+ return MEMCACHED_END;
else if (buffer[1] == 'R')
return MEMCACHED_PROTOCOL_ERROR;
else
default:
return MEMCACHED_UNKNOWN_READ_FAILURE;
- return MEMCACHED_READ_FAILURE;
}
return MEMCACHED_SUCCESS;