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

Function connTLSAccept

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

Source from the content-addressed store, hash-verified

700}
701
702static int connTLSAccept(connection *_conn, ConnectionCallbackFunc accept_handler) {
703 tls_connection *conn = (tls_connection *) _conn;
704 int ret;
705
706 if (conn->c.state != CONN_STATE_ACCEPTING) return C_ERR;
707 ERR_clear_error();
708
709 /* Try to accept */
710 conn->c.conn_handler = accept_handler;
711 ret = SSL_accept(conn->ssl);
712
713 if (ret <= 0) {
714 WantIOType want = 0;
715 if (!handleSSLReturnCode(conn, ret, &want)) {
716 registerSSLEvent(conn, want); /* We'll fire back */
717 return C_OK;
718 } else {
719 conn->c.state = CONN_STATE_ERROR;
720 return C_ERR;
721 }
722 }
723
724 conn->c.state = CONN_STATE_CONNECTED;
725 if (!callHandler((connection *) conn, conn->c.conn_handler)) return C_OK;
726 conn->c.conn_handler = NULL;
727
728 return C_OK;
729}
730
731static int connTLSConnect(connection *conn_, const char *addr, int port, const char *src_addr, ConnectionCallbackFunc connect_handler) {
732 tls_connection *conn = (tls_connection *) conn_;

Callers

nothing calls this directly

Calls 3

handleSSLReturnCodeFunction · 0.85
registerSSLEventFunction · 0.85
callHandlerFunction · 0.85

Tested by

no test coverage detected