mirror of
https://github.com/signalwire/freeswitch.git
synced 2025-04-15 16:39:14 +00:00
Tweak some mutexes
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@16903 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
parent
bb62df6e9f
commit
3786722149
@ -245,7 +245,6 @@ static void close_socket(SOCKET * sock)
|
|||||||
static void close_socket(int *sock)
|
static void close_socket(int *sock)
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
switch_mutex_lock(listen_list.sock_mutex);
|
|
||||||
if (*sock) {
|
if (*sock) {
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
shutdown(*sock, SD_BOTH);
|
shutdown(*sock, SD_BOTH);
|
||||||
@ -256,7 +255,6 @@ static void close_socket(int *sock)
|
|||||||
#endif
|
#endif
|
||||||
sock = NULL;
|
sock = NULL;
|
||||||
}
|
}
|
||||||
switch_mutex_unlock(listen_list.sock_mutex);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -453,7 +451,7 @@ static switch_xml_t erlang_fetch(const char *sectionstr, const char *tag_name, c
|
|||||||
if (!p->reply) {
|
if (!p->reply) {
|
||||||
p->state = reply_timeout;
|
p->state = reply_timeout;
|
||||||
switch_mutex_unlock(globals.fetch_reply_mutex);
|
switch_mutex_unlock(globals.fetch_reply_mutex);
|
||||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Timed out after %d milliseconds when waiting for XML fetch response\n", (int) (switch_micro_time_now() - now) / 1000);
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Timed out after %d milliseconds when waiting for XML fetch response for %s\n", (int) (switch_micro_time_now() - now) / 1000, uuid_str);
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -476,7 +474,7 @@ static switch_xml_t erlang_fetch(const char *sectionstr, const char *tag_name, c
|
|||||||
|
|
||||||
ei_decode_string_or_binary(rep->buff, &rep->index, size, xmlstr);
|
ei_decode_string_or_binary(rep->buff, &rep->index, size, xmlstr);
|
||||||
|
|
||||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "got data %s after %d milliseconds from %s!\n", xmlstr, (int) (switch_micro_time_now() - now) / 1000, p->winner);
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "got data %s after %d milliseconds from %s for %s!\n", xmlstr, (int) (switch_micro_time_now() - now) / 1000, p->winner, uuid_str);
|
||||||
|
|
||||||
if (zstr(xmlstr)) {
|
if (zstr(xmlstr)) {
|
||||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "No Result\n");
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "No Result\n");
|
||||||
@ -546,11 +544,11 @@ static switch_status_t notify_new_session(listener_t *listener, session_elem_t *
|
|||||||
ei_x_encode_tuple_header(&lbuf, 2);
|
ei_x_encode_tuple_header(&lbuf, 2);
|
||||||
ei_x_encode_atom(&lbuf, "call");
|
ei_x_encode_atom(&lbuf, "call");
|
||||||
ei_encode_switch_event(&lbuf, call_event);
|
ei_encode_switch_event(&lbuf, call_event);
|
||||||
switch_mutex_lock(listener->sock_mutex);
|
|
||||||
switch_log_printf(SWITCH_CHANNEL_UUID_LOG(session_element->uuid_str), SWITCH_LOG_DEBUG, "Sending initial call event for %s\n",
|
switch_log_printf(SWITCH_CHANNEL_UUID_LOG(session_element->uuid_str), SWITCH_LOG_DEBUG, "Sending initial call event for %s\n",
|
||||||
session_element->uuid_str);
|
session_element->uuid_str);
|
||||||
result = ei_sendto(listener->ec, listener->sockfd, &session_element->process, &lbuf);
|
|
||||||
|
|
||||||
|
switch_mutex_lock(listener->sock_mutex);
|
||||||
|
result = ei_sendto(listener->ec, listener->sockfd, &session_element->process, &lbuf);
|
||||||
switch_mutex_unlock(listener->sock_mutex);
|
switch_mutex_unlock(listener->sock_mutex);
|
||||||
|
|
||||||
if (result) {
|
if (result) {
|
||||||
@ -1666,8 +1664,6 @@ SWITCH_MODULE_RUNTIME_FUNCTION(mod_erlang_event_runtime)
|
|||||||
return SWITCH_STATUS_TERM;
|
return SWITCH_STATUS_TERM;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch_mutex_init(&listen_list.sock_mutex, SWITCH_MUTEX_NESTED, pool);
|
|
||||||
|
|
||||||
/* zero out the struct before we use it */
|
/* zero out the struct before we use it */
|
||||||
memset(&server_addr, 0, sizeof(server_addr));
|
memset(&server_addr, 0, sizeof(server_addr));
|
||||||
|
|
||||||
|
@ -166,7 +166,6 @@ struct listen_list_struct {
|
|||||||
#else
|
#else
|
||||||
int sockfd;
|
int sockfd;
|
||||||
#endif
|
#endif
|
||||||
switch_mutex_t *sock_mutex;
|
|
||||||
listener_t *listeners;
|
listener_t *listeners;
|
||||||
uint8_t ready;
|
uint8_t ready;
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user