X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;f=libmemcached%2Fprotocol%2Fprotocol_handler.c;h=fcab1419f7c100083a232b0c405cb0ccf65da806;hb=4cd075fbd0fab78e393c1559db340a221196a006;hp=fb90001db940548c385c635c71c671050d4b8c1c;hpb=8cc3921d72dabcc2a89c38bbee08007b7abe6976;p=awesomized%2Flibmemcached diff --git a/libmemcached/protocol/protocol_handler.c b/libmemcached/protocol/protocol_handler.c index fb90001d..fcab1419 100644 --- a/libmemcached/protocol/protocol_handler.c +++ b/libmemcached/protocol/protocol_handler.c @@ -3,7 +3,6 @@ #include #include -#include #include #include #include @@ -29,7 +28,7 @@ * @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) { @@ -49,7 +48,7 @@ static ssize_t default_recv(const void *cookie, * @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) { @@ -79,13 +78,13 @@ static bool drain_output(struct memcached_protocol_client_st *client) 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; } } @@ -270,7 +269,7 @@ void memcached_protocol_destroy_instance(struct memcached_protocol_st *instance) 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) @@ -343,9 +342,9 @@ memcached_protocol_event_t memcached_protocol_client_work(struct memcached_proto } 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; }