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

Function connSocketConnect

app/redis-6.2.6/src/connection.c:102–119  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

100}
101
102static int connSocketConnect(connection *conn, const char *addr, int port, const char *src_addr,
103 ConnectionCallbackFunc connect_handler) {
104 int fd = anetTcpNonBlockBestEffortBindConnect(NULL,addr,port,src_addr);
105 if (fd == -1) {
106 conn->state = CONN_STATE_ERROR;
107 conn->last_errno = errno;
108 return C_ERR;
109 }
110
111 conn->fd = fd;
112 conn->state = CONN_STATE_CONNECTING;
113
114 conn->conn_handler = connect_handler;
115 aeCreateFileEvent(server.el, conn->fd, AE_WRITABLE,
116 conn->type->ae_handler, conn);
117
118 return C_OK;
119}
120
121/* Returns true if a write handler is registered */
122int connHasWriteHandler(connection *conn) {

Callers

nothing calls this directly

Calls 2

aeCreateFileEventFunction · 0.85

Tested by

no test coverage detected