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

Function createSocketAcceptHandler

app/redis-6.2.6/src/server.c:3016–3027  ·  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

3014/* Create an event handler for accepting new connections in TCP or TLS domain sockets.
3015 * This works atomically for all socket fds */
3016int createSocketAcceptHandler(socketFds *sfd, aeFileProc *accept_handler) {
3017 int j;
3018
3019 for (j = 0; j < sfd->count; j++) {
3020 if (aeCreateFileEvent(server.el, sfd->fd[j], AE_READABLE, accept_handler,NULL) == AE_ERR) {
3021 /* Rollback */
3022 for (j = j-1; j >= 0; j--) aeDeleteFileEvent(server.el, sfd->fd[j], AE_READABLE);
3023 return C_ERR;
3024 }
3025 }
3026 return C_OK;
3027}
3028
3029/* Initialize a set of file descriptors to listen to the specified 'port'
3030 * binding the addresses specified in the Redis server configuration.

Callers 4

initServerFunction · 0.85
changeBindAddrFunction · 0.85
changeListenPortFunction · 0.85
clusterInitFunction · 0.85

Calls 2

aeCreateFileEventFunction · 0.85
aeDeleteFileEventFunction · 0.85

Tested by

no test coverage detected