11 int t,
int rfd,
int wfd, SSL *
ssl,
char *
buf,
int len)
25 tv.tv_sec = (time_t)t; tv.tv_usec = 0;
28 switch (SSL_get_error(
ssl,r)) {
30 case SSL_ERROR_WANT_READ:
31 FD_SET(rfd,&
fds); n = select(rfd + 1,&
fds,NULL,NULL,&tv);
33 case SSL_ERROR_WANT_WRITE:
34 FD_SET(wfd,&
fds); n = select(wfd + 1,NULL,&
fds,NULL,&tv);
41 if (n != -1) errno = ETIMEDOUT;
50 if (ndelay_on(rfd) == -1 || ndelay_on(wfd) == -1)
return -1;
53 if (r <= 0) { ndelay_off(rfd); ndelay_off(wfd); }
54 else SSL_set_mode(
ssl,SSL_MODE_ENABLE_PARTIAL_WRITE);
64 if (ndelay_on(rfd) == -1 || ndelay_on(wfd) == -1)
return -1;
67 if (r <= 0) { ndelay_off(rfd); ndelay_off(wfd); }
68 else SSL_set_mode(
ssl,SSL_MODE_ENABLE_PARTIAL_WRITE);
80 if (SSL_get_state(
ssl) & SSL_ST_CONNECT)
return -2;
83 SSL_set_connect_state(
ssl);
91 if (SSL_pending(
ssl))
return SSL_read(
ssl,
buf,len);
int tls_timeoutconn(int t, int rfd, int wfd, SSL *ssl)
int tls_timeoutwrite(int t, int rfd, int wfd, SSL *ssl, char *buf, int len)
int tls_timeoutaccept(int t, int rfd, int wfd, SSL *ssl)
int tls_timeoutrehandshake(int t, int rfd, int wfd, SSL *ssl)
int tls_timeoutread(int t, int rfd, int wfd, SSL *ssl, char *buf, int len)
int tls_timeoutio(int(*fun)(), int t, int rfd, int wfd, SSL *ssl, char *buf, int len)