MCPcopy Create free account
hub / github.com/Snapchat/KeyDB / anetSetReuseAddr

Function anetSetReuseAddr

src/anet.c:250–259  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

248}
249
250static int anetSetReuseAddr(char *err, int fd) {
251 int yes = 1;
252 /* Make sure connection-intensive things like the redis benchmark
253 * will be able to close/open sockets a zillion of times */
254 if (setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &yes, sizeof(yes)) == -1) {
255 anetSetError(err, "setsockopt SO_REUSEADDR: %s", strerror(errno));
256 return ANET_ERR;
257 }
258 return ANET_OK;
259}
260
261static int anetSetReusePort(char *err, int fd) {
262 int yes = 1;

Callers 3

anetCreateSocketFunction · 0.85
anetTcpGenericConnectFunction · 0.85
_anetTcpServerFunction · 0.85

Calls 1

anetSetErrorFunction · 0.85

Tested by

no test coverage detected