This commit is contained in:
Anthony Minessale 2013-05-07 11:30:37 -05:00
parent 01a748869d
commit b2a9c71df6

View File

@ -193,8 +193,6 @@ handshake (struct stream_data *data)
#elif HAVE_SSL #elif HAVE_SSL
static int wait_for_data(struct stream_data *data, int ret, int timeout) static int wait_for_data(struct stream_data *data, int ret, int timeout)
{ {
struct timeval tv;
fd_set fds;
int err; int err;
int retval = IKS_OK; int retval = IKS_OK;
@ -238,11 +236,11 @@ handshake (struct stream_data *data)
data->ssl = SSL_new(data->ssl_ctx); data->ssl = SSL_new(data->ssl_ctx);
if(!data->ssl) return IKS_NOMEM; if(!data->ssl) return IKS_NOMEM;
if( SSL_set_fd(data->ssl, (int)data->sock) != 1 ) return IKS_NOMEM; if( SSL_set_fd(data->ssl, (int)(intptr_t)data->sock) != 1 ) return IKS_NOMEM;
/* Set both the read and write BIO's to non-blocking mode */ /* Set both the read and write BIO's to non-blocking mode */
BIO_set_nbio(SSL_get_rbio(data->ssl), 1); //BIO_set_nbio(SSL_get_rbio(data->ssl), 1);
BIO_set_nbio(SSL_get_wbio(data->ssl), 1); //BIO_set_nbio(SSL_get_wbio(data->ssl), 1);
finished = 0; finished = 0;
@ -641,7 +639,7 @@ iks_connect_fd (iksparser *prs, int fd)
if (NULL == data->buf) return IKS_NOMEM; if (NULL == data->buf) return IKS_NOMEM;
} }
data->sock = (void *) fd; data->sock = (void *) (intptr_t) fd;
data->flags |= SF_FOREIGN; data->flags |= SF_FOREIGN;
data->trans = &iks_default_transport; data->trans = &iks_default_transport;
@ -659,7 +657,7 @@ iks_fd (iksparser *prs)
if (prs) { if (prs) {
data = iks_user_data (prs); data = iks_user_data (prs);
if (data) { if (data) {
return (int) data->sock; return (int)(intptr_t) data->sock;
} }
} }
return -1; return -1;
@ -673,8 +671,6 @@ iks_recv (iksparser *prs, int timeout)
#ifdef HAVE_SSL #ifdef HAVE_SSL
int err; int err;
struct timeval tv;
fd_set fds;
#endif #endif
while (1) { while (1) {
@ -692,9 +688,7 @@ iks_recv (iksparser *prs, int timeout)
} else if( ret == 0 ) { } else if( ret == 0 ) {
return IKS_OK; return IKS_OK;
} else { } else {
do {
len = SSL_read(data->ssl, data->buf, NET_IO_BUF_SIZE - 1); len = SSL_read(data->ssl, data->buf, NET_IO_BUF_SIZE - 1);
} while (len == -1 && (errno == EAGAIN || errno == EINTR || SSL_get_error(data->ssl, len) == SSL_ERROR_WANT_READ));
} }
if( len <= 0 ) if( len <= 0 )