diff --git a/libs/sofia-sip/.update b/libs/sofia-sip/.update index 0b779c7ab1..7465198045 100644 --- a/libs/sofia-sip/.update +++ b/libs/sofia-sip/.update @@ -1 +1 @@ -Wed Feb 21 13:55:11 CDT 2018 +Mon Nov 13 13:48:40 CST 2017 diff --git a/libs/sofia-sip/libsofia-sip-ua/tport/tport_type_ws.c b/libs/sofia-sip/libsofia-sip-ua/tport/tport_type_ws.c index 3ce3b4a005..de0cda565f 100644 --- a/libs/sofia-sip/libsofia-sip-ua/tport/tport_type_ws.c +++ b/libs/sofia-sip/libsofia-sip-ua/tport/tport_type_ws.c @@ -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; diff --git a/libs/sofia-sip/libsofia-sip-ua/tport/ws.c b/libs/sofia-sip/libsofia-sip-ua/tport/ws.c index 3dc776f530..32fee259b4 100644 --- a/libs/sofia-sip/libsofia-sip-ua/tport/ws.c +++ b/libs/sofia-sip/libsofia-sip-ua/tport/ws.c @@ -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)); diff --git a/src/mod/endpoints/mod_verto/ws.c b/src/mod/endpoints/mod_verto/ws.c index 3dc776f530..32fee259b4 100644 --- a/src/mod/endpoints/mod_verto/ws.c +++ b/src/mod/endpoints/mod_verto/ws.c @@ -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));