FS-9638 #comment fix seg when read -1
This commit is contained in:
parent
407c1b20dd
commit
f3b7105d66
|
@ -403,8 +403,15 @@ static switch_status_t msrp_socket_recv(msrp_client_socket_t *csock, char *buf,
|
|||
switch_status_t status = SWITCH_STATUS_FALSE;
|
||||
|
||||
if (csock->secure) {
|
||||
*len = SSL_read(globals.ssl, buf, *len);
|
||||
if (*len) status = SWITCH_STATUS_SUCCESS;
|
||||
ssize_t r;
|
||||
r = SSL_read(globals.ssl, buf, *len);
|
||||
if (r < 0) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "TLS read error: %" SWITCH_SSIZE_T_FMT "\n", r);
|
||||
*len = 0;
|
||||
} else {
|
||||
*len = r;
|
||||
status = SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
} else {
|
||||
status = switch_socket_recv(csock->sock, buf, len);
|
||||
}
|
||||
|
@ -960,7 +967,7 @@ static void *SWITCH_THREAD_FUNC msrp_worker(switch_thread_t *thread, void *obj)
|
|||
msrp_msg = NULL;
|
||||
|
||||
while (msrp_socket_recv(csock, p, &len) == SWITCH_STATUS_SUCCESS) {
|
||||
// switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "read bytes:%ld\n", len);
|
||||
// switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "read bytes:%" SWITCH_SIZE_T_FMT "\n", len);
|
||||
|
||||
if (helper->debug) dump_buffer(buf, (p - buf) + len, __LINE__);
|
||||
|
||||
|
|
Loading…
Reference in New Issue