MCPcopy Create free account
hub / github.com/F-Stack/f-stack / anetSetReuseAddr

Function anetSetReuseAddr

app/redis-6.2.6/src/anet.c:260–269  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

258}
259
260static int anetSetReuseAddr(char *err, int fd) {
261 int yes = 1;
262 /* Make sure connection-intensive things like the redis benchmark
263 * will be able to close/open sockets a zillion of times */
264 if (setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &yes, sizeof(yes)) == -1) {
265 anetSetError(err, "setsockopt SO_REUSEADDR: %s", strerror(errno));
266 return ANET_ERR;
267 }
268 return ANET_OK;
269}
270
271static int anetCreateSocket(char *err, int domain) {
272 int s;

Callers 3

anetCreateSocketFunction · 0.85
anetTcpGenericConnectFunction · 0.85
_anetTcpServerFunction · 0.85

Calls 2

anetSetErrorFunction · 0.85
setsockoptFunction · 0.70

Tested by

no test coverage detected