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

Function anetCreateSocket

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

Source from the content-addressed store, hash-verified

269}
270
271static int anetCreateSocket(char *err, int domain) {
272 int s;
273 if ((s = socket(domain, SOCK_STREAM, 0)) == -1) {
274 anetSetError(err, "creating socket: %s", strerror(errno));
275 return ANET_ERR;
276 }
277
278 /* Make sure connection-intensive things like the redis benchmark
279 * will be able to close/open sockets a zillion of times */
280 if (anetSetReuseAddr(err,s) == ANET_ERR) {
281 close(s);
282 return ANET_ERR;
283 }
284 return s;
285}
286
287#define ANET_CONNECT_NONE 0
288#define ANET_CONNECT_NONBLOCK 1

Callers 2

anetUnixGenericConnectFunction · 0.85
anetUnixServerFunction · 0.85

Calls 4

anetSetErrorFunction · 0.85
anetSetReuseAddrFunction · 0.85
socketFunction · 0.70
closeFunction · 0.70

Tested by

no test coverage detected