FS-6854 #resolve

This commit is contained in:
Anthony Minessale 2014-09-25 21:43:57 +05:00
parent 221af936d8
commit f7de058acd
3 changed files with 31 additions and 11 deletions

View File

@ -1 +1 @@
Wed Sep 24 01:09:42 CDT 2014
Thu Sep 25 21:43:53 CDT 2014

View File

@ -332,19 +332,22 @@ ssize_t ws_raw_read(wsh_t *wsh, void *data, size_t bytes, int block)
ssize_t r;
int err = 0;
wsh->x++;
if (wsh->x > 250) ms_sleep(1);
if (wsh->ssl) {
do {
r = SSL_read(wsh->ssl, data, bytes);
ms_sleep(10);
if (r == -1) {
err = SSL_get_error(wsh->ssl, r);
if (!block && err == SSL_ERROR_WANT_READ) {
r = -2;
goto end;
}
if (block) ms_sleep(10);
}
} while (r == -1 && err == SSL_ERROR_WANT_READ && wsh->x < 100);
@ -354,10 +357,17 @@ ssize_t ws_raw_read(wsh_t *wsh, void *data, size_t bytes, int block)
do {
r = recv(wsh->sock, data, bytes, 0);
ms_sleep(10);
if (r == -1) {
if (!block && xp_is_blocking(xp_errno())) {
r = -2;
goto end;
}
if (block) ms_sleep(10);
}
} while (r == -1 && xp_is_blocking(xp_errno()) && wsh->x < 100);
if (wsh->x >= 100) {
if (wsh->x >= 1000 || (block && wsh->x >= 100)) {
r = -1;
}

View File

@ -332,19 +332,22 @@ ssize_t ws_raw_read(wsh_t *wsh, void *data, size_t bytes, int block)
ssize_t r;
int err = 0;
wsh->x++;
if (wsh->x > 250) ms_sleep(1);
if (wsh->ssl) {
do {
r = SSL_read(wsh->ssl, data, bytes);
ms_sleep(10);
if (r == -1) {
err = SSL_get_error(wsh->ssl, r);
if (!block && err == SSL_ERROR_WANT_READ) {
r = -2;
goto end;
}
if (block) ms_sleep(10);
}
} while (r == -1 && err == SSL_ERROR_WANT_READ && wsh->x < 100);
@ -354,10 +357,17 @@ ssize_t ws_raw_read(wsh_t *wsh, void *data, size_t bytes, int block)
do {
r = recv(wsh->sock, data, bytes, 0);
ms_sleep(10);
if (r == -1) {
if (!block && xp_is_blocking(xp_errno())) {
r = -2;
goto end;
}
if (block) ms_sleep(10);
}
} while (r == -1 && xp_is_blocking(xp_errno()) && wsh->x < 100);
if (wsh->x >= 100) {
if (wsh->x >= 1000 || (block && wsh->x >= 100)) {
r = -1;
}