| 840 | } |
| 841 | |
| 842 | static 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 | |
| 866 | static ssize_t connTLSSyncWrite(connection *conn_, char *ptr, ssize_t size, long long timeout) { |
| 867 | tls_connection *conn = (tls_connection *) conn_; |
nothing calls this directly
no test coverage detected