#include <stdlib.h>
#include <sys/types.h>
-#include <sys/socket.h>
#include <errno.h>
#include <stdbool.h>
#include <string.h>
* @return the number of bytes transferred of -1 upon error
*/
static ssize_t default_recv(const void *cookie,
- int sock,
+ memcached_socket_t sock,
void *buf,
size_t nbytes)
{
* @return the number of bytes transferred of -1 upon error
*/
static ssize_t default_send(const void *cookie,
- int fd,
+ memcached_socket_t fd,
const void *buf,
size_t nbytes)
{
if (len == -1)
{
- if (errno == EWOULDBLOCK)
+ if (get_socket_errno() == EWOULDBLOCK)
{
return true;
}
- else if (errno != EINTR)
+ else if (get_socket_errno() != EINTR)
{
- client->error= errno;
+ client->error= get_socket_errno();
return false;
}
}
free(instance);
}
-struct memcached_protocol_client_st *memcached_protocol_create_client(struct memcached_protocol_st *instance, int sock)
+struct memcached_protocol_client_st *memcached_protocol_create_client(struct memcached_protocol_st *instance, memcached_socket_t sock)
{
struct memcached_protocol_client_st *ret= calloc(1, sizeof(*ret));
if (ret != NULL)
}
else
{
- if (errno != EWOULDBLOCK)
+ if (get_socket_errno() != EWOULDBLOCK)
{
- client->error= errno;
+ client->error= get_socket_errno();
/* mark this client as terminated! */
return MEMCACHED_PROTOCOL_ERROR_EVENT;
}