FS-10762: [freeswitch-core] Websocket logic error
This commit is contained in:
parent
1064bb043c
commit
c5e662c9bc
|
@ -1 +1 @@
|
|||
Wed Feb 21 13:55:11 CDT 2018
|
||||
Mon Nov 13 13:48:40 CST 2017
|
||||
|
|
|
@ -314,16 +314,26 @@ ssize_t tport_send_stream_ws(tport_t const *self, msg_t *msg,
|
|||
if (nerror == -1) {
|
||||
int err = su_errno();
|
||||
if (su_is_blocking(err))
|
||||
break;
|
||||
break;
|
||||
SU_DEBUG_3(("ws_write: %s\n", strerror(err)));
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
if (wstp->wstp_buflen) {
|
||||
ssize_t wrote = 0;
|
||||
|
||||
*(wstp->wstp_buffer + wstp->wstp_buflen) = '\0';
|
||||
ws_write_frame(&wstp->ws, WSOC_TEXT, wstp->wstp_buffer, wstp->wstp_buflen);
|
||||
size = wstp->wstp_buflen;
|
||||
wrote = ws_write_frame(&wstp->ws, WSOC_TEXT, wstp->wstp_buffer, wstp->wstp_buflen);
|
||||
|
||||
if (wrote < 0) {
|
||||
int err = su_errno();
|
||||
SU_DEBUG_3(("ws_write_frame: %s\n", strerror(err)));
|
||||
size = wrote;
|
||||
|
||||
} else {
|
||||
size = wstp->wstp_buflen;
|
||||
}
|
||||
}
|
||||
|
||||
return size;
|
||||
|
|
|
@ -448,8 +448,10 @@ ssize_t ws_raw_write(wsh_t *wsh, void *data, size_t bytes)
|
|||
ssl_err = 0;
|
||||
}
|
||||
|
||||
} while (--sanity > 0 && wsh->block && wrote < bytes);
|
||||
} while (--sanity > 0 && wrote < bytes);
|
||||
|
||||
if (!sanity) ssl_err = 56;
|
||||
|
||||
if (ssl_err) {
|
||||
r = ssl_err * -1;
|
||||
}
|
||||
|
@ -469,9 +471,9 @@ ssize_t ws_raw_write(wsh_t *wsh, void *data, size_t bytes)
|
|||
|
||||
if (wsh->block) {
|
||||
if (sanity < WS_WRITE_SANITY * 3 / 4) {
|
||||
ms = 60;
|
||||
ms = 50;
|
||||
} else if (sanity < WS_WRITE_SANITY / 2) {
|
||||
ms = 10;
|
||||
ms = 25;
|
||||
}
|
||||
}
|
||||
ms_sleep(ms);
|
||||
|
@ -483,7 +485,7 @@ ssize_t ws_raw_write(wsh_t *wsh, void *data, size_t bytes)
|
|||
}
|
||||
}
|
||||
|
||||
} while (--sanity > 0 && wsh->block && wrote < bytes);
|
||||
} while (--sanity > 0 && wrote < bytes);
|
||||
|
||||
//if (r<0) {
|
||||
//printf("wRITE FAIL: %s\n", strerror(errno));
|
||||
|
|
|
@ -448,8 +448,10 @@ ssize_t ws_raw_write(wsh_t *wsh, void *data, size_t bytes)
|
|||
ssl_err = 0;
|
||||
}
|
||||
|
||||
} while (--sanity > 0 && wsh->block && wrote < bytes);
|
||||
} while (--sanity > 0 && wrote < bytes);
|
||||
|
||||
if (!sanity) ssl_err = 56;
|
||||
|
||||
if (ssl_err) {
|
||||
r = ssl_err * -1;
|
||||
}
|
||||
|
@ -469,9 +471,9 @@ ssize_t ws_raw_write(wsh_t *wsh, void *data, size_t bytes)
|
|||
|
||||
if (wsh->block) {
|
||||
if (sanity < WS_WRITE_SANITY * 3 / 4) {
|
||||
ms = 60;
|
||||
ms = 50;
|
||||
} else if (sanity < WS_WRITE_SANITY / 2) {
|
||||
ms = 10;
|
||||
ms = 25;
|
||||
}
|
||||
}
|
||||
ms_sleep(ms);
|
||||
|
@ -483,7 +485,7 @@ ssize_t ws_raw_write(wsh_t *wsh, void *data, size_t bytes)
|
|||
}
|
||||
}
|
||||
|
||||
} while (--sanity > 0 && wsh->block && wrote < bytes);
|
||||
} while (--sanity > 0 && wrote < bytes);
|
||||
|
||||
//if (r<0) {
|
||||
//printf("wRITE FAIL: %s\n", strerror(errno));
|
||||
|
|
Loading…
Reference in New Issue