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

Function connTLSBlockingConnect

app/redis-6.2.6/src/tls.c:842–864  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

840}
841
842static int connTLSBlockingConnect(connection *conn_, const char *addr, int port, long long timeout) {
843 tls_connection *conn = (tls_connection *) conn_;
844 int ret;
845
846 if (conn->c.state != CONN_STATE_NONE) return C_ERR;
847
848 /* Initiate socket blocking connect first */
849 if (CT_Socket.blocking_connect(conn_, addr, port, timeout) == C_ERR) return C_ERR;
850
851 /* Initiate TLS connection now. We set up a send/recv timeout on the socket,
852 * which means the specified timeout will not be enforced accurately. */
853 SSL_set_fd(conn->ssl, conn->c.fd);
854 setBlockingTimeout(conn, timeout);
855
856 if ((ret = SSL_connect(conn->ssl)) <= 0) {
857 conn->c.state = CONN_STATE_ERROR;
858 return C_ERR;
859 }
860 unsetBlockingTimeout(conn);
861
862 conn->c.state = CONN_STATE_CONNECTED;
863 return C_OK;
864}
865
866static ssize_t connTLSSyncWrite(connection *conn_, char *ptr, ssize_t size, long long timeout) {
867 tls_connection *conn = (tls_connection *) conn_;

Callers

nothing calls this directly

Calls 2

setBlockingTimeoutFunction · 0.85
unsetBlockingTimeoutFunction · 0.85

Tested by

no test coverage detected