diff options
-rw-r--r-- | libfreerdp-core/crypto/openssl.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/libfreerdp-core/crypto/openssl.c b/libfreerdp-core/crypto/openssl.c index 333585b..84417d7 100644 --- a/libfreerdp-core/crypto/openssl.c +++ b/libfreerdp-core/crypto/openssl.c @@ -21,6 +21,7 @@ #include "crypto.h" #include <freerdp/utils/memory.h> #include <freerdp/constants/constants.h> +#include <time.h> #include "tls.h" #include "crypto/openssl.h" @@ -349,6 +350,7 @@ struct rdp_tls { SSL_CTX * ctx; SSL * ssl; + struct timespec ts; }; RD_BOOL @@ -428,6 +430,10 @@ tls_new(void) SSL_CTX_set_options(tls->ctx, SSL_OP_ALL); + /* a small 0.1ms delay when network blocking happens. */ + tls->ts.tv_sec = 0; + tls->ts.tv_nsec = 100000; + return tls; } @@ -515,6 +521,7 @@ tls_write(rdpTls * tls, char* b, int length) break; case SSL_ERROR_WANT_WRITE: + nanosleep(&tls->ts, NULL); break; default: @@ -543,6 +550,7 @@ tls_read(rdpTls * tls, char* b, int length) break; case SSL_ERROR_WANT_READ: + nanosleep(&tls->ts, NULL); break; default: |