Merge branch 'master' of ssh://stash.freeswitch.org:7999/fs/freeswitch

This commit is contained in:
Brian West
2014-09-25 15:10:51 -05:00
10 changed files with 58 additions and 21 deletions
+15 -5
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;
}