projects
/
redis.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
69e7958
)
added explanation for the magic 511 backlog number
author
Erik Dubbelboer
<erik@dubbelboer.com>
Wed, 11 Apr 2012 15:04:31 +0000
(17:04 +0200)
committer
Erik Dubbelboer
<erik@dubbelboer.com>
Wed, 11 Apr 2012 15:04:31 +0000
(17:04 +0200)
src/anet.c
patch
|
blob
|
blame
|
history
diff --git
a/src/anet.c
b/src/anet.c
index ba4e6cce89bbc7a552e8510a03a2cb67c53af1f6..434d945c7d850edd8b8a8934d254bbc88e5d62d0 100644
(file)
--- a/
src/anet.c
+++ b/
src/anet.c
@@
-262,7
+262,11
@@
static int anetListen(char *err, int s, struct sockaddr *sa, socklen_t len) {
close(s);
return ANET_ERR;
}
close(s);
return ANET_ERR;
}
- if (listen(s, 511) == -1) { /* the magic 511 constant is from nginx */
+
+ /* Use a backlog of 512 entries. We pass 511 to the listen() call because
+ * the kernel does: backlogsize = roundup_pow_of_two(backlogsize + 1);
+ * which will thus give us a backlog of 512 entries */
+ if (listen(s, 511) == -1) {
anetSetError(err, "listen: %s", strerror(errno));
close(s);
return ANET_ERR;
anetSetError(err, "listen: %s", strerror(errno));
close(s);
return ANET_ERR;