aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--channels/chan_iax2.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/channels/chan_iax2.c b/channels/chan_iax2.c
index 3cf2596fb..6fc1b6580 100644
--- a/channels/chan_iax2.c
+++ b/channels/chan_iax2.c
@@ -9252,6 +9252,7 @@ static int socket_read(int *id, int fd, short events, void *cbdata)
memcpy(&thread->ffinfo.sin, &thread->iosin, sizeof(thread->ffinfo.sin));
thread->ffinfo.type = fh->type;
thread->ffinfo.csub = fh->csub;
+ AST_LIST_INSERT_HEAD(&active_list, thread, list);
}
AST_LIST_UNLOCK(&active_list);
}
@@ -11215,11 +11216,6 @@ static void *iax2_process_thread(void *data)
if (thread->iostate == IAX_IOSTATE_IDLE)
continue;
- /* Add ourselves to the active list now */
- AST_LIST_LOCK(&active_list);
- AST_LIST_INSERT_HEAD(&active_list, thread, list);
- AST_LIST_UNLOCK(&active_list);
-
/* See what we need to do */
switch(thread->iostate) {
case IAX_IOSTATE_READY:
@@ -11243,7 +11239,9 @@ static void *iax2_process_thread(void *data)
thread->curfunc[0]='\0';
#endif
- /* Now... remove ourselves from the active list, and return to the idle list */
+ /* The network thread added us to the active_thread list when we were given
+ * frames to process, Now that we are done, we must remove ourselves from
+ * the active list, and return to the idle list */
AST_LIST_LOCK(&active_list);
AST_LIST_REMOVE(&active_list, thread, list);
AST_LIST_UNLOCK(&active_list);