int sfd = socket(AF_INET6, SOCK_STREAM, 0);
if (sfd < 0) continue;
struct timeval timeout;
timeout.tv_sec = 60;
timeout.tv_usec = 0;
setsockopt(sfd, SOL_SOCKET, SO_RCVTIMEO, (char *) &timeout, sizeof(timeout));
setsockopt(sfd, SOL_SOCKET, SO_SNDTIMEO, (char *) &timeout, sizeof(timeout));
if (connect(sfd, (struct sockaddr*) &ig, sizeof(struct sockaddr_in6))) {
close(sfd);
continue;
}
SSL* ssl = SSL_new(ctx);
if (ssl == NULL) {
close(sfd);
continue;
}
SSL_set_connect_state(ssl);
SSL_set_fd(ssl, sfd);
printf("%i\n", SSL_get_fd(ssl));
int con = SSL_connect(ssl);
OpenSSL causes a SIGPIPE to be fired on the line that I call SSL_connect on. I ran through with GDB and ensured that the socket is not closed. In /proc/fd/#, the socket does not appear closed before or after. I tried switching the order of my set_fd and connect_state calls. I imagine I messed something up with OpenSSL, but I cannot seem to figure it out.