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

Function createSocketAcceptHandler

src/server.cpp:3668–3679  ·  view source on GitHub ↗

Create an event handler for accepting new connections in TCP or TLS domain sockets. * This works atomically for all socket fds */

Source from the content-addressed store, hash-verified

3666/* Create an event handler for accepting new connections in TCP or TLS domain sockets.
3667 * This works atomically for all socket fds */
3668int createSocketAcceptHandler(socketFds *sfd, aeFileProc *accept_handler) {
3669 int j;
3670
3671 for (j = 0; j < sfd->count; j++) {
3672 if (aeCreateFileEvent(serverTL->el, sfd->fd[j], AE_READABLE, accept_handler,NULL) == AE_ERR) {
3673 /* Rollback */
3674 for (j = j-1; j >= 0; j--) aeDeleteFileEvent(serverTL->el, sfd->fd[j], AE_READABLE);
3675 return C_ERR;
3676 }
3677 }
3678 return C_OK;
3679}
3680
3681/* Initialize a set of file descriptors to listen to the specified 'port'
3682 * binding the addresses specified in the Redis server configuration.

Callers 3

clusterInitFunction · 0.85
changeBindAddrFunction · 0.85
changeListenPortFunction · 0.85

Calls 2

aeCreateFileEventFunction · 0.85
aeDeleteFileEventFunction · 0.85

Tested by

no test coverage detected