#include <stdlib.h>
#include <sys/types.h>
-#include <sys/socket.h>
#include <errno.h>
#include <stdbool.h>
#include <string.h>
if (!client->root->drain(client))
{
- return PROTOCOL_BINARY_RESPONSE_EIO;
+ return PROTOCOL_BINARY_RESPONSE_EINTERNAL;
}
size_t len= sizeof(*response) + htonl(response->response.bodylen);
num_bytes);
if (nw == -1)
{
- if (errno == EWOULDBLOCK)
+ if (get_socket_errno() == EWOULDBLOCK)
{
break;
}
- else if (errno != EINTR)
+ else if (get_socket_errno() != EINTR)
{
client->error= errno;
- return PROTOCOL_BINARY_RESPONSE_EIO;
+ return PROTOCOL_BINARY_RESPONSE_EINTERNAL;
}
}
else
.extlen= 4,
.bodylen= htonl(bodylen + keylen + 4),
},
- .message.body.flags= htonl(flags),
};
+ response.message.body.flags= htonl(flags);
+
protocol_binary_response_status rval;
const protocol_binary_response_status success= PROTOCOL_BINARY_RESPONSE_SUCCESS;
if ((rval= client->root->spool(client, response.bytes, sizeof(response.bytes))) != success ||
}
/* I need a better way to signal to close the connection */
- return PROTOCOL_BINARY_RESPONSE_EIO;
+ return PROTOCOL_BINARY_RESPONSE_EINTERNAL;
}
/**
}
if (rval != PROTOCOL_BINARY_RESPONSE_SUCCESS &&
- rval != PROTOCOL_BINARY_RESPONSE_EIO &&
- rval != PROTOCOL_BINARY_RESPONSE_PAUSE)
+ rval != PROTOCOL_BINARY_RESPONSE_EINTERNAL &&
+ rval != PROTOCOL_BINARY_RESPONSE_NOT_SUPPORTED)
{
protocol_binary_response_no_extras response= {
.message= {
client->current_command= header;
protocol_binary_response_status rv= execute_command(client, header);
- if (rv == PROTOCOL_BINARY_RESPONSE_EIO)
+ if (rv == PROTOCOL_BINARY_RESPONSE_EINTERNAL)
{
*length= len;
*endptr= (void*)header;
return MEMCACHED_PROTOCOL_ERROR_EVENT;
- } else if (rv == PROTOCOL_BINARY_RESPONSE_PAUSE)
+ } else if (rv == PROTOCOL_BINARY_RESPONSE_NOT_SUPPORTED)
return MEMCACHED_PROTOCOL_PAUSE_EVENT;
ssize_t total= (ssize_t)(sizeof(*header) + ntohl(header->request.bodylen));