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

Function acceptTcpHandler

src/networking.cpp:1389–1409  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1387}
1388
1389void acceptTcpHandler(aeEventLoop *el, int fd, void *privdata, int mask) {
1390 int cport, cfd, max = MAX_ACCEPTS_PER_CALL;
1391 char cip[NET_IP_STR_LEN];
1392 UNUSED(mask);
1393 UNUSED(privdata);
1394 UNUSED(el);
1395
1396 while(max--) {
1397 cfd = anetTcpAccept(serverTL->neterr, fd, cip, sizeof(cip), &cport);
1398 if (cfd == ANET_ERR) {
1399 if (errno != EWOULDBLOCK)
1400 serverLog(LL_WARNING,
1401 "Accepting client connection: %s", serverTL->neterr);
1402 return;
1403 }
1404 anetCloexec(cfd);
1405 serverLog(LL_VERBOSE,"Accepted %s:%d", cip, cport);
1406
1407 acceptOnThread(connCreateAcceptedSocket(cfd), 0, cip);
1408 }
1409}
1410
1411void acceptTLSHandler(aeEventLoop *el, int fd, void *privdata, int mask) {
1412 int cport, cfd, max = MAX_ACCEPTS_PER_CALL_TLS;

Callers

nothing calls this directly

Calls 5

anetTcpAcceptFunction · 0.85
serverLogFunction · 0.85
anetCloexecFunction · 0.85
acceptOnThreadFunction · 0.85
connCreateAcceptedSocketFunction · 0.85

Tested by

no test coverage detected