FS-9638 fail when write doesn't work

This commit is contained in:
Anthony Minessale 2016-11-14 12:40:17 -06:00
parent 3b50883734
commit 27eb116f03
2 changed files with 9 additions and 3 deletions

View File

@ -128,7 +128,11 @@ static void text_bridge_thread(switch_core_session_t *session, void *obj)
}
if (!switch_test_flag(read_frame, SFF_CNG)) {
switch_core_session_write_text_frame(vh->session_b, read_frame, 0, 0);
switch_status_t tstatus = switch_core_session_write_text_frame(vh->session_b, read_frame, 0, 0);
if (tstatus != SWITCH_STATUS_SUCCESS) {
switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
}
}
switch_core_session_write_text_frame(vh->session_a, NULL, 0, 0);
}

View File

@ -1151,7 +1151,10 @@ SWITCH_DECLARE(switch_status_t) switch_msrp_send(switch_msrp_session_t *ms, msrp
char *to_path = msrp_msg->headers[MSRP_H_TO_PATH] ? msrp_msg->headers[MSRP_H_TO_PATH] : ms->remote_path;
char *from_path = msrp_msg->headers[MSRP_H_FROM_PATH] ? msrp_msg->headers[MSRP_H_FROM_PATH] : ms->local_path;
if (!from_path) return SWITCH_STATUS_SUCCESS;
if (!from_path) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "NO FROM PATH\n");
return SWITCH_STATUS_SUCCESS;
}
random_string(transaction_id, MSRP_TRANS_ID_LEN);
@ -1179,7 +1182,6 @@ SWITCH_DECLARE(switch_status_t) switch_msrp_send(switch_msrp_session_t *ms, msrp
sprintf(buf + len, "\r\n-------%s$\r\n", transaction_id);
len += (12 + strlen(transaction_id));
if (globals.debug) switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "---------------------send: %" SWITCH_SIZE_T_FMT " bytes\n%s\n", len, buf);
return ms->csock ? msrp_socket_send(ms->csock, buf, &len) : SWITCH_STATUS_FALSE;
}