File tree Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -6687,15 +6687,17 @@ inline ssize_t SSLSocketStream::read(char *ptr, size_t size) {
6687
6687
auto ret = SSL_read (ssl_, ptr, static_cast <int >(size));
6688
6688
if (ret < 0 ) {
6689
6689
auto err = SSL_get_error (ssl_, ret);
6690
+ int n = 1000 ;
6690
6691
#ifdef _WIN32
6691
- while (err == SSL_ERROR_WANT_READ ||
6692
- err == SSL_ERROR_SYSCALL && WSAGetLastError () == WSAETIMEDOUT) {
6692
+ while (--n >= 0 && ( err == SSL_ERROR_WANT_READ ||
6693
+ err == SSL_ERROR_SYSCALL && WSAGetLastError () == WSAETIMEDOUT)) {
6693
6694
#else
6694
- while (err == SSL_ERROR_WANT_READ) {
6695
+ while (--n >= 0 && err == SSL_ERROR_WANT_READ) {
6695
6696
#endif
6696
6697
if (SSL_pending (ssl_) > 0 ) {
6697
6698
return SSL_read (ssl_, ptr, static_cast <int >(size));
6698
6699
} else if (is_readable ()) {
6700
+ std::this_thread::sleep_for (std::chrono::milliseconds (1 ));
6699
6701
ret = SSL_read (ssl_, ptr, static_cast <int >(size));
6700
6702
if (ret >= 0 ) { return ret; }
6701
6703
err = SSL_get_error (ssl_, ret);
You can’t perform that action at this time.
0 commit comments