summaryrefslogtreecommitdiffstats
path: root/common/ssl_calls.c
diff options
context:
space:
mode:
authorJay Sorg <jay.sorg@gmail.com>2017-02-23 12:02:48 -0800
committerjsorg71 <jay.sorg@gmail.com>2017-02-25 20:52:27 -0800
commit657f6f3756f883e2a5899eaff9e0e59c4bc67995 (patch)
tree476db488efde65d85753a76a14c5e32ff813b42d /common/ssl_calls.c
parentdccd95ee93c26e4efe3955c470efa9301f7d5d33 (diff)
downloadxrdp-proprietary-657f6f3756f883e2a5899eaff9e0e59c4bc67995.tar.gz
xrdp-proprietary-657f6f3756f883e2a5899eaff9e0e59c4bc67995.zip
common: use select for SSL_ERROR_WANT_READ, SSL_ERROR_WANT_WRITE tls errors
Diffstat (limited to 'common/ssl_calls.c')
-rw-r--r--common/ssl_calls.c27
1 files changed, 17 insertions, 10 deletions
diff --git a/common/ssl_calls.c b/common/ssl_calls.c
index 77a8db23..0bae2f5e 100644
--- a/common/ssl_calls.c
+++ b/common/ssl_calls.c
@@ -34,6 +34,7 @@
#include "ssl_calls.h"
#include "trans.h"
+#define SSL_WANT_READ_WRITE_TIMEOUT 100
#if OPENSSL_VERSION_NUMBER < 0x10100000L
static inline HMAC_CTX *
@@ -726,13 +727,16 @@ ssl_tls_read(struct ssl_tls *tls, char *data, int length)
break_flag = 1;
break;
+ /**
+ * retry when SSL_get_error returns:
+ * SSL_ERROR_WANT_READ
+ * SSL_ERROR_WANT_WRITE
+ */
case SSL_ERROR_WANT_READ:
+ g_sck_can_recv(tls->trans->sck, SSL_WANT_READ_WRITE_TIMEOUT);
+ continue;
case SSL_ERROR_WANT_WRITE:
- /**
- * retry when SSL_get_error returns:
- * SSL_ERROR_WANT_READ
- * SSL_ERROR_WANT_WRITE
- */
+ g_sck_can_send(tls->trans->sck, SSL_WANT_READ_WRITE_TIMEOUT);
continue;
default:
@@ -772,13 +776,16 @@ ssl_tls_write(struct ssl_tls *tls, const char *data, int length)
break_flag = 1;
break;
+ /**
+ * retry when SSL_get_error returns:
+ * SSL_ERROR_WANT_READ
+ * SSL_ERROR_WANT_WRITE
+ */
case SSL_ERROR_WANT_READ:
+ g_sck_can_recv(tls->trans->sck, SSL_WANT_READ_WRITE_TIMEOUT);
+ continue;
case SSL_ERROR_WANT_WRITE:
- /**
- * retry when SSL_get_error returns:
- * SSL_ERROR_WANT_READ
- * SSL_ERROR_WANT_WRITE
- */
+ g_sck_can_send(tls->trans->sck, SSL_WANT_READ_WRITE_TIMEOUT);
continue;
default: