refactor mod_event_socket so it uses switch_log functions to duplicate and free log nodes while it uses them internally (fix bad ptr for userdata on event socket listeners)

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@14598 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Mathieu Rene
2009-08-22 19:26:58 +00:00
parent 35947acdda
commit 5abd10c0c3
3 changed files with 31 additions and 16 deletions

View File

@@ -97,7 +97,26 @@ static switch_log_node_t* switch_log_node_alloc()
return node;
}
static void switch_log_node_free(switch_log_node_t **pnode)
SWITCH_DECLARE(switch_log_node_t*) switch_log_node_dup(const switch_log_node_t *node)
{
switch_log_node_t *newnode = switch_log_node_alloc();
*newnode = *node;
if (!switch_strlen_zero(node->data)) {
newnode->data = strdup(node->data);
switch_assert(node->data);
}
if (!switch_strlen_zero(node->userdata)) {
newnode->userdata = strdup(node->userdata);
switch_assert(node->userdata);
}
return newnode;
}
SWITCH_DECLARE(void) switch_log_node_free(switch_log_node_t **pnode)
{
switch_log_node_t *node;
@@ -284,6 +303,7 @@ static void *SWITCH_THREAD_FUNC log_thread(switch_thread_t *t, void *obj)
switch_mutex_unlock(BINDLOCK);
switch_log_node_free(&node);
}
THREAD_RUNNING = 0;