[asterisk-commits] kmoore: branch kmoore/stasis-bridge_events r385470 - in /team/kmoore/stasis-b...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Fri Apr 12 08:15:01 CDT 2013
Author: kmoore
Date: Fri Apr 12 08:14:57 2013
New Revision: 385470
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=385470
Log:
Multiple revisions 385358,385376,385379,385394-385395,385432
........
r385358 | root | 2013-04-11 15:17:20 -0500 (Thu, 11 Apr 2013) | 15 lines
Blocked revisions 385356
........
Add dependency on libuuid, for res_rtp_asterisk
pjproject is what actually requires libuuid.
(closes issue ASTERISK-21125)
reported by Private Name
(Ed. note: Really? Private Name? I am rolling my eyes so hard right now.)
........
Merged revisions 385357 from file:///srv/subversion/repos/asterisk/trunk
........
r385376 | kmoore | 2013-04-11 15:55:33 -0500 (Thu, 11 Apr 2013) | 2 lines
Add missing include
........
r385379 | rmudgett | 2013-04-11 16:46:14 -0500 (Thu, 11 Apr 2013) | 1 line
Make ast_stasis_bridging_init() return failure condition.
........
r385394 | mjordan | 2013-04-11 20:32:42 -0500 (Thu, 11 Apr 2013) | 7 lines
Don't return the value of ao2_link
1) It returns 1 on success; 0 on error. Most things don't expect that.
2) If ao2_link does fail, you've gone into troubled waters
3) We don't typically check the success/failure of it anywhere else.
........
r385395 | mjordan | 2013-04-11 20:43:42 -0500 (Thu, 11 Apr 2013) | 6 lines
For now, move the string ao2 container into astobj2
The utils folder won't compile with ao2 objects in strings.c, as it has a silly
build system.
........
r385432 | root | 2013-04-12 04:18:08 -0500 (Fri, 12 Apr 2013) | 51 lines
Multiple revisions 385406,385431
........
r385406 | alecdavis | 2013-04-12 03:18:20 -0500 (Fri, 12 Apr 2013) | 24 lines
IAX2, prevent network thread starting before all helper threads are ready
On startup, it's possible for a frame to arrive before the processing threads were ready.
In iax2_process_thread() the first pass through falls into ast_cond_wait, should a frame arrive
before we are at ast_cond_wait, the signal will be ignored.
The result iax2_process_thread stays at ast_cond_wait forever, with deferred frames being queued.
Fix: When creating initial idle iax2_process_threads, wait for init_cond to be signalled
after each thread is started.
(issue ASTERISK-18827)
Reported by: alecdavis
Tested by: alecdavis
alecdavis (license 585)
Review https://reviewboard.asterisk.org/r/2427/
........
Merged revisions 385402 from http://svn.asterisk.org/svn/asterisk/branches/1.8
........
Merged revisions 385403 from http://svn.asterisk.org/svn/asterisk/branches/11
........
r385431 | alecdavis | 2013-04-12 03:52:44 -0500 (Fri, 12 Apr 2013) | 17 lines
IAX2 defer_full_frames fail to get sent
Ensure iax2_process_thread is signalled when a deferred frame is queued to it.
(closes issue ASTERISK-18827)
Reported by: alecdavis
Tested by: alecdavis
alecdavis (license 585)
Review https://reviewboard.asterisk.org/r/2426/
........
Merged revisions 385429 from http://svn.asterisk.org/svn/asterisk/branches/1.8
........
Merged revisions 385430 from http://svn.asterisk.org/svn/asterisk/branches/11
........
Merged revisions 385406,385431 from file:///srv/subversion/repos/asterisk/trunk
........
Merged revisions 385358,385376,385379,385394-385395,385432 from http://svn.asterisk.org/svn/asterisk/team/group/bridge_construction
........
Merged revisions 385469 from http://svn.asterisk.org/svn/asterisk/team/kmoore/stasis-bridging-channel_events
Modified:
team/kmoore/stasis-bridge_events/ (props changed)
team/kmoore/stasis-bridge_events/channels/chan_iax2.c
team/kmoore/stasis-bridge_events/include/asterisk/astobj2.h
team/kmoore/stasis-bridge_events/include/asterisk/stasis_bridging.h
team/kmoore/stasis-bridge_events/include/asterisk/strings.h
team/kmoore/stasis-bridge_events/main/astobj2.c
team/kmoore/stasis-bridge_events/main/bridging.c
team/kmoore/stasis-bridge_events/main/stasis_bridging.c
team/kmoore/stasis-bridge_events/main/strings.c
Propchange: team/kmoore/stasis-bridge_events/
------------------------------------------------------------------------------
--- branch-11-blocked (original)
+++ branch-11-blocked Fri Apr 12 08:14:57 2013
@@ -1,1 +1,1 @@
-/branches/11:373240,375247,375702
+/branches/11:373240,375247,375702,385356
Propchange: team/kmoore/stasis-bridge_events/
------------------------------------------------------------------------------
Binary property 'branch-11-merged' - no diff available.
Propchange: team/kmoore/stasis-bridge_events/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Fri Apr 12 08:14:57 2013
@@ -1,1 +1,1 @@
-/team/kmoore/stasis-bridging-channel_events:1-385353
+/team/kmoore/stasis-bridging-channel_events:1-385469
Modified: team/kmoore/stasis-bridge_events/channels/chan_iax2.c
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/stasis-bridge_events/channels/chan_iax2.c?view=diff&rev=385470&r1=385469&r2=385470
==============================================================================
--- team/kmoore/stasis-bridge_events/channels/chan_iax2.c (original)
+++ team/kmoore/stasis-bridge_events/channels/chan_iax2.c Fri Apr 12 08:14:57 2013
@@ -9514,6 +9514,9 @@
if (!cur_pkt_buf)
AST_LIST_INSERT_TAIL(&to_here->full_frames, pkt_buf, entry);
+
+ to_here->iostate = IAX_IOSTATE_READY;
+ ast_cond_signal(&to_here->cond);
ast_mutex_unlock(&to_here->lock);
}
@@ -12232,16 +12235,26 @@
ast_cond_init(&thread->cond, NULL);
ast_mutex_init(&thread->init_lock);
ast_cond_init(&thread->init_cond, NULL);
+
+ ast_mutex_lock(&thread->init_lock);
+
if (ast_pthread_create_background(&thread->threadid, NULL, iax2_process_thread, thread)) {
ast_log(LOG_WARNING, "Failed to create new thread!\n");
ast_mutex_destroy(&thread->lock);
ast_cond_destroy(&thread->cond);
+ ast_mutex_unlock(&thread->init_lock);
ast_mutex_destroy(&thread->init_lock);
ast_cond_destroy(&thread->init_cond);
ast_free(thread);
thread = NULL;
continue;
}
+ /* Wait for the thread to be ready */
+ ast_cond_wait(&thread->init_cond, &thread->init_lock);
+
+ /* Done with init_lock */
+ ast_mutex_unlock(&thread->init_lock);
+
AST_LIST_LOCK(&idle_list);
AST_LIST_INSERT_TAIL(&idle_list, thread, list);
AST_LIST_UNLOCK(&idle_list);
Modified: team/kmoore/stasis-bridge_events/include/asterisk/astobj2.h
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/stasis-bridge_events/include/asterisk/astobj2.h?view=diff&rev=385470&r1=385469&r2=385470
==============================================================================
--- team/kmoore/stasis-bridge_events/include/asterisk/astobj2.h (original)
+++ team/kmoore/stasis-bridge_events/include/asterisk/astobj2.h Fri Apr 12 08:14:57 2013
@@ -1883,4 +1883,37 @@
#define ao2_cleanup(obj) __ao2_cleanup(obj)
#endif
void ao2_iterator_cleanup(struct ao2_iterator *iter);
+
+
+/* XXX TODO BUGBUG and all the other things...
+ * These functions should eventually be moved elsewhere, but the utils folder
+ * won't compile with them in strings.h
+ */
+
+/*!
+ * \since 12
+ * \brief Allocates a hash container for bare strings
+ *
+ * \param buckets The number of buckets to use for the hash container
+ *
+ * \retval AO2 container for strings
+ * \retval NULL if allocation failed
+ */
+struct ao2_container *ast_str_container_alloc(int buckets);
+
+/*!
+ * \since 12
+ * \brief Adds a string to a string container allocated by ast_str_container_alloc
+ *
+ * \param str_container The container to which to add a string
+ * \param add The string to add to the container
+ *
+ * \retval zero on success
+ * \retval non-zero if the operation failed
+ */
+int ast_str_container_add(struct ao2_container *str_container, const char *add);
+
+
+
+
#endif /* _ASTERISK_ASTOBJ2_H */
Modified: team/kmoore/stasis-bridge_events/include/asterisk/stasis_bridging.h
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/stasis-bridge_events/include/asterisk/stasis_bridging.h?view=diff&rev=385470&r1=385469&r2=385470
==============================================================================
--- team/kmoore/stasis-bridge_events/include/asterisk/stasis_bridging.h (original)
+++ team/kmoore/stasis-bridge_events/include/asterisk/stasis_bridging.h Fri Apr 12 08:14:57 2013
@@ -209,8 +209,10 @@
/*!
* \brief Initialize the stasis bridging topic and message types
- */
-void ast_stasis_bridging_init(void);
+ * \retval 0 on success
+ * \retval -1 on failure
+ */
+int ast_stasis_bridging_init(void);
#if defined(__cplusplus) || defined(c_plusplus)
}
Modified: team/kmoore/stasis-bridge_events/include/asterisk/strings.h
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/stasis-bridge_events/include/asterisk/strings.h?view=diff&rev=385470&r1=385469&r2=385470
==============================================================================
--- team/kmoore/stasis-bridge_events/include/asterisk/strings.h (original)
+++ team/kmoore/stasis-bridge_events/include/asterisk/strings.h Fri Apr 12 08:14:57 2013
@@ -29,6 +29,7 @@
#include "asterisk/utils.h"
#include "asterisk/threadstorage.h"
+#include "asterisk/astobj2.h"
#if defined(DEBUG_OPAQUE)
#define __AST_STR_USED used2
@@ -1013,26 +1014,5 @@
return abs(hash);
}
-/*!
- * \since 12
- * \brief Allocates a hash container for bare strings
- *
- * \param buckets The number of buckets to use for the hash container
- *
- * \retval AO2 container for strings
- * \retval NULL if allocation failed
- */
-struct ao2_container *ast_str_container_alloc(int buckets);
-
-/*!
- * \since 12
- * \brief Adds a string to a string container allocated by ast_str_container_alloc
- *
- * \param str_container The container to which to add a string
- * \param add The string to add to the container
- *
- * \retval zero on success
- * \retval non-zero if the operation failed
- */
-int ast_str_container_add(struct ao2_container *str_container, const char *add);
+
#endif /* _ASTERISK_STRINGS_H */
Modified: team/kmoore/stasis-bridge_events/main/astobj2.c
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/stasis-bridge_events/main/astobj2.c?view=diff&rev=385470&r1=385469&r2=385470
==============================================================================
--- team/kmoore/stasis-bridge_events/main/astobj2.c (original)
+++ team/kmoore/stasis-bridge_events/main/astobj2.c Fri Apr 12 08:14:57 2013
@@ -5779,3 +5779,36 @@
return 0;
}
+
+/* XXX TODO BUGBUG and all the other things...
+ * These functions should eventually be moved elsewhere, but the utils folder
+ * won't compile with them in strings.h
+ */
+static int str_hash(const void *obj, const int flags)
+{
+ return ast_str_hash(obj);
+}
+
+static int str_cmp(void *lhs, void *rhs, int flags)
+{
+ return strcmp(lhs, rhs) ? 0 : CMP_MATCH;
+}
+
+struct ao2_container *ast_str_container_alloc(int buckets)
+{
+ return ao2_container_alloc(buckets, str_hash, str_cmp);
+}
+
+int ast_str_container_add(struct ao2_container *str_container, const char *add)
+{
+ RAII_VAR(char *, ao2_add, ao2_alloc(strlen(add) + 1, NULL), ao2_cleanup);
+
+ if (!ao2_add) {
+ return -1;
+ }
+
+ /* safe strcpy */
+ strcpy(ao2_add, add);
+ ao2_link(str_container, ao2_add);
+ return 0;
+}
Modified: team/kmoore/stasis-bridge_events/main/bridging.c
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/stasis-bridge_events/main/bridging.c?view=diff&rev=385470&r1=385469&r2=385470
==============================================================================
--- team/kmoore/stasis-bridge_events/main/bridging.c (original)
+++ team/kmoore/stasis-bridge_events/main/bridging.c Fri Apr 12 08:14:57 2013
@@ -4073,13 +4073,16 @@
int ast_bridging_init(void)
{
+ if (ast_stasis_bridging_init()) {
+ bridge_shutdown();
+ return -1;
+ }
+
bridge_manager = bridge_manager_create();
if (!bridge_manager) {
return -1;
}
- ast_stasis_bridging_init();
-
ast_register_atexit(bridge_shutdown);
return 0;
}
Modified: team/kmoore/stasis-bridge_events/main/stasis_bridging.c
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/stasis-bridge_events/main/stasis_bridging.c?view=diff&rev=385470&r1=385469&r2=385470
==============================================================================
--- team/kmoore/stasis-bridge_events/main/stasis_bridging.c (original)
+++ team/kmoore/stasis-bridge_events/main/stasis_bridging.c Fri Apr 12 08:14:57 2013
@@ -339,7 +339,7 @@
return snapshot->uniqueid;
}
-void ast_stasis_bridging_init(void)
+int ast_stasis_bridging_init(void)
{
bridge_snapshot_type = stasis_message_type_create("ast_bridge_snapshot");
bridge_blob_type = stasis_message_type_create("ast_bridge_blob");
@@ -347,4 +347,10 @@
bridge_topic_all = stasis_topic_create("ast_bridge_topic_all");
bridge_topic_all_cached = stasis_caching_topic_create(bridge_topic_all, bridge_snapshot_get_id);
bridge_topic_pool = stasis_topic_pool_create(bridge_topic_all);
-}
+ return !bridge_snapshot_type
+ || !bridge_blob_type
+ || !bridge_merge_message_type
+ || !bridge_topic_all
+ || !bridge_topic_all_cached
+ || !bridge_topic_pool ? -1 : 0;
+}
Modified: team/kmoore/stasis-bridge_events/main/strings.c
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/stasis-bridge_events/main/strings.c?view=diff&rev=385470&r1=385469&r2=385470
==============================================================================
--- team/kmoore/stasis-bridge_events/main/strings.c (original)
+++ team/kmoore/stasis-bridge_events/main/strings.c Fri Apr 12 08:14:57 2013
@@ -160,30 +160,4 @@
return (*buf)->__AST_STR_STR;
}
-static int str_hash(const void *obj, const int flags)
-{
- return ast_str_hash(obj);
-}
-static int str_cmp(void *lhs, void *rhs, int flags)
-{
- return strcmp(lhs, rhs) ? 0 : CMP_MATCH;
-}
-
-struct ao2_container *ast_str_container_alloc(int buckets)
-{
- return ao2_container_alloc(buckets, str_hash, str_cmp);
-}
-
-int ast_str_container_add(struct ao2_container *str_container, const char *add)
-{
- RAII_VAR(char *, ao2_add, ao2_alloc(strlen(add) + 1, NULL), ao2_cleanup);
-
- if (!ao2_add) {
- return -1;
- }
-
- /* safe strcpy */
- strcpy(ao2_add, add);
- return ao2_link(str_container, ao2_add);
-}
More information about the asterisk-commits
mailing list