summaryrefslogtreecommitdiff
path: root/tests/test_cel.c
diff options
context:
space:
mode:
authorJoshua Colp <jcolp@digium.com>2013-12-18 19:28:05 +0000
committerJoshua Colp <jcolp@digium.com>2013-12-18 19:28:05 +0000
commite2630fcd516b8f794bf342d9fd267b0c905e79ce (patch)
treef6cd5cf70eb9af24b239d78391aed7472c09dd7f /tests/test_cel.c
parente23b8d19a49d4ee4faf3dc167ddb7ba7afe36a46 (diff)
channels: Return allocated channels locked.
This change makes ast_channel_alloc return allocated channels locked. By doing so no other thread can acquire, lock, and manipulate the channel before it is completely set up. (closes issue AST-1256) Review: https://reviewboard.asterisk.org/r/3067/ ........ Merged revisions 404204 from http://svn.asterisk.org/svn/asterisk/branches/12 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@404210 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'tests/test_cel.c')
-rw-r--r--tests/test_cel.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/tests/test_cel.c b/tests/test_cel.c
index 7732f3e9d..7da4f9ee8 100644
--- a/tests/test_cel.c
+++ b/tests/test_cel.c
@@ -201,24 +201,28 @@ static void do_sleep(void)
#define CREATE_ALICE_CHANNEL(channel_var, caller_id) do { \
(channel_var) = ast_channel_alloc(0, AST_STATE_DOWN, (caller_id)->id.number.str, (caller_id)->id.name.str, "100", "100", "default", NULL, 0, CHANNEL_TECH_NAME "/Alice"); \
APPEND_EVENT(channel_var, AST_CEL_CHANNEL_START, NULL, NULL); \
+ ast_channel_unlock((channel_var)); \
} while (0)
/*! \brief Create a \ref test_cel_chan_tech for Bob. */
#define CREATE_BOB_CHANNEL(channel_var, caller_id) do { \
(channel_var) = ast_channel_alloc(0, AST_STATE_DOWN, (caller_id)->id.number.str, (caller_id)->id.name.str, "200", "200", "default", NULL, 0, CHANNEL_TECH_NAME "/Bob"); \
APPEND_EVENT(channel_var, AST_CEL_CHANNEL_START, NULL, NULL); \
+ ast_channel_unlock((channel_var)); \
} while (0)
/*! \brief Create a \ref test_cel_chan_tech for Charlie. */
#define CREATE_CHARLIE_CHANNEL(channel_var, caller_id) do { \
(channel_var) = ast_channel_alloc(0, AST_STATE_DOWN, (caller_id)->id.number.str, (caller_id)->id.name.str, "300", "300", "default", NULL, 0, CHANNEL_TECH_NAME "/Charlie"); \
APPEND_EVENT(channel_var, AST_CEL_CHANNEL_START, NULL, NULL); \
+ ast_channel_unlock((channel_var)); \
} while (0)
/*! \brief Create a \ref test_cel_chan_tech for David. */
#define CREATE_DAVID_CHANNEL(channel_var, caller_id) do { \
(channel_var) = ast_channel_alloc(0, AST_STATE_DOWN, (caller_id)->id.number.str, (caller_id)->id.name.str, "400", "400", "default", NULL, 0, CHANNEL_TECH_NAME "/David"); \
APPEND_EVENT(channel_var, AST_CEL_CHANNEL_START, NULL, NULL); \
+ ast_channel_unlock((channel_var)); \
} while (0)
/*! \brief Emulate a channel entering into an application */
@@ -717,6 +721,7 @@ AST_TEST_DEFINE(test_cel_single_multiparty_bridge)
#define START_DIALED_FULL(caller, callee, number, name) do { \
callee = ast_channel_alloc(0, AST_STATE_DOWN, NULL, NULL, number, NULL, NULL, ast_channel_linkedid(caller), 0, CHANNEL_TECH_NAME "/" name); \
+ ast_channel_unlock(callee); \
if (append_expected_event(callee, AST_CEL_CHANNEL_START, NULL, NULL, NULL)) { \
return AST_TEST_FAIL; \
} \