X-Git-Url: https://git.saurik.com/redis.git/blobdiff_plain/ed9b544e10b84cd43348ddfab7068b610a5df1f7..c44d3b56df4ce4cae1c2e6db6397eaab9651ff7a:/anet.c diff --git a/anet.c b/anet.c index bcb99057..4fe811a1 100644 --- a/anet.c +++ b/anet.c @@ -1,6 +1,6 @@ /* anet.c -- Basic TCP socket stuff made a bit less boring * - * Copyright (c) 2006-2009, Salvatore Sanfilippo + * Copyright (c) 2006-2010, Salvatore Sanfilippo * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -28,6 +28,8 @@ * POSSIBILITY OF SUCH DAMAGE. */ +#include "fmacros.h" + #include #include #include @@ -177,7 +179,7 @@ int anetTcpNonBlockConnect(char *err, char *addr, int port) /* Like read(2) but make sure 'count' is read before to return * (unless error or EOF condition is encountered) */ -int anetRead(int fd, void *buf, int count) +int anetRead(int fd, char *buf, int count) { int nread, totlen = 0; while(totlen != count) { @@ -192,7 +194,7 @@ int anetRead(int fd, void *buf, int count) /* Like write(2) but make sure 'count' is read before to return * (unless error is encountered) */ -int anetWrite(int fd, void *buf, int count) +int anetWrite(int fd, char *buf, int count) { int nwritten, totlen = 0; while(totlen != count) { @@ -235,7 +237,7 @@ int anetTcpServer(char *err, int port, char *bindaddr) close(s); return ANET_ERR; } - if (listen(s, 32) == -1) { + if (listen(s, 511) == -1) { /* the magic 511 constant is from nginx */ anetSetError(err, "listen: %s\n", strerror(errno)); close(s); return ANET_ERR;