| 1176 | } |
| 1177 | |
| 1178 | static int connTLSBlockingConnect(connection *conn_, const char *addr, int port, long long timeout) { |
| 1179 | tls_connection *conn = (tls_connection *) conn_; |
| 1180 | int ret; |
| 1181 | |
| 1182 | serverAssert(conn->el == serverTL->el); |
| 1183 | |
| 1184 | if (conn->c.state != CONN_STATE_NONE) return C_ERR; |
| 1185 | |
| 1186 | /* Initiate socket blocking connect first */ |
| 1187 | if (CT_Socket.blocking_connect(conn_, addr, port, timeout) == C_ERR) return C_ERR; |
| 1188 | |
| 1189 | /* Initiate TLS connection now. We set up a send/recv timeout on the socket, |
| 1190 | * which means the specified timeout will not be enforced accurately. */ |
| 1191 | SSL_set_fd(conn->ssl, conn->c.fd); |
| 1192 | setBlockingTimeout(conn, timeout); |
| 1193 | |
| 1194 | if ((ret = SSL_connect(conn->ssl)) <= 0) { |
| 1195 | conn->c.state = CONN_STATE_ERROR; |
| 1196 | return C_ERR; |
| 1197 | } |
| 1198 | unsetBlockingTimeout(conn); |
| 1199 | |
| 1200 | conn->c.state = CONN_STATE_CONNECTED; |
| 1201 | return C_OK; |
| 1202 | } |
| 1203 | |
| 1204 | static ssize_t connTLSSyncWrite(connection *conn_, const char *ptr, ssize_t size, long long timeout) { |
| 1205 | tls_connection *conn = (tls_connection *) conn_; |
nothing calls this directly
no test coverage detected