mirror of
https://github.com/signalwire/freeswitch.git
synced 2025-04-10 14:39:54 +00:00
log websocket write failures
This commit is contained in:
parent
f2887fb89e
commit
88940d3833
@ -517,6 +517,7 @@ static switch_ssize_t ws_write_json(jsock_t *jsock, cJSON **json, switch_bool_t
|
|||||||
switch_assert(json);
|
switch_assert(json);
|
||||||
|
|
||||||
if (!*json) {
|
if (!*json) {
|
||||||
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ALERT, "WRITE NULL JS ERROR %ld\n", r);
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -535,7 +536,7 @@ static switch_ssize_t ws_write_json(jsock_t *jsock, cJSON **json, switch_bool_t
|
|||||||
free(log_text);
|
free(log_text);
|
||||||
}
|
}
|
||||||
switch_mutex_lock(jsock->write_mutex);
|
switch_mutex_lock(jsock->write_mutex);
|
||||||
ws_write_frame(&jsock->ws, WSOC_TEXT, json_text, strlen(json_text));
|
r = ws_write_frame(&jsock->ws, WSOC_TEXT, json_text, strlen(json_text));
|
||||||
switch_mutex_unlock(jsock->write_mutex);
|
switch_mutex_unlock(jsock->write_mutex);
|
||||||
switch_safe_free(json_text);
|
switch_safe_free(json_text);
|
||||||
}
|
}
|
||||||
@ -545,6 +546,10 @@ static switch_ssize_t ws_write_json(jsock_t *jsock, cJSON **json, switch_bool_t
|
|||||||
*json = NULL;
|
*json = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (r <= 0) {
|
||||||
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ALERT, "WRITE RETURNED ERROR %ld\n", r);
|
||||||
|
}
|
||||||
|
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1730,7 +1735,10 @@ static switch_status_t verto_send_media_indication(switch_core_session_t *sessio
|
|||||||
|
|
||||||
switch_set_flag(tech_pvt, TFLAG_SENT_MEDIA);
|
switch_set_flag(tech_pvt, TFLAG_SENT_MEDIA);
|
||||||
|
|
||||||
ws_write_json(jsock, &msg, SWITCH_TRUE);
|
if (ws_write_json(jsock, &msg, SWITCH_TRUE) <= 0) {
|
||||||
|
switch_channel_hangup(tech_pvt->channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
|
||||||
|
}
|
||||||
|
|
||||||
switch_thread_rwlock_unlock(jsock->rwlock);
|
switch_thread_rwlock_unlock(jsock->rwlock);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -3902,7 +3910,9 @@ static int verto_send_chat(const char *uid, const char *call_id, cJSON *msg)
|
|||||||
jsock_t *jsock;
|
jsock_t *jsock;
|
||||||
|
|
||||||
if ((jsock = get_jsock(tech_pvt->jsock_uuid))) {
|
if ((jsock = get_jsock(tech_pvt->jsock_uuid))) {
|
||||||
ws_write_json(jsock, &msg, SWITCH_FALSE);
|
if (ws_write_json(jsock, &msg, SWITCH_FALSE) <= 0) {
|
||||||
|
switch_channel_hangup(switch_core_session_get_channel(session), SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
|
||||||
|
}
|
||||||
switch_thread_rwlock_unlock(jsock->rwlock);
|
switch_thread_rwlock_unlock(jsock->rwlock);
|
||||||
done = 1;
|
done = 1;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user