Logger: Convert 'struct ast_callid' to unsigned int.

Switch logger callid's from AO2 objects to simple integers.
This helps in two ways.  Copying integers is faster than
referencing AO2 objects, so this will result in a small
reduction in logger overhead.  This also erases the possibility
of an infinate loop caused by an invalid callid in
threadstorage.

ASTERISK-24833 #comment Committed callid conversion to trunk. 
Reported by: Corey Farrell
Review: https://reviewboard.asterisk.org/r/4466/


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@432834 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Corey Farrell
2015-03-13 01:12:35 +00:00
parent 38ee441ea7
commit c08fd275bf
33 changed files with 182 additions and 373 deletions

View File

@@ -96,7 +96,7 @@ struct ast_channel {
struct ast_tone_zone *zone; /*!< Tone zone as set in indications.conf or
* in the CHANNEL dialplan function */
struct ast_channel_monitor *monitor; /*!< Channel monitoring */
struct ast_callid *callid; /*!< Bound call identifier pointer */
ast_callid callid; /*!< Bound call identifier pointer */
#ifdef HAVE_EPOLL
struct ast_epoll_data *epfd_data[AST_MAX_FDS];
#endif
@@ -914,15 +914,11 @@ enum ast_channel_state ast_channel_state(const struct ast_channel *chan)
{
return chan->state;
}
struct ast_callid *ast_channel_callid(const struct ast_channel *chan)
ast_callid ast_channel_callid(const struct ast_channel *chan)
{
if (chan->callid) {
ast_callid_ref(chan->callid);
return chan->callid;
}
return NULL;
return chan->callid;
}
void ast_channel_callid_set(struct ast_channel *chan, struct ast_callid *callid)
void ast_channel_callid_set(struct ast_channel *chan, ast_callid callid)
{
char call_identifier_from[AST_CALLID_BUFFER_LENGTH];
char call_identifier_to[AST_CALLID_BUFFER_LENGTH];
@@ -931,11 +927,9 @@ void ast_channel_callid_set(struct ast_channel *chan, struct ast_callid *callid)
if (chan->callid) {
ast_callid_strnprint(call_identifier_from, sizeof(call_identifier_from), chan->callid);
ast_debug(3, "Channel Call ID changing from %s to %s\n", call_identifier_from, call_identifier_to);
/* unbind if already set */
ast_callid_unref(chan->callid);
}
chan->callid = ast_callid_ref(callid);
chan->callid = callid;
ast_test_suite_event_notify("CallIDChange",
"State: CallIDChange\r\n"
@@ -1165,9 +1159,7 @@ void ast_channel_set_unbridged(struct ast_channel *chan, int value)
void ast_channel_callid_cleanup(struct ast_channel *chan)
{
if (chan->callid) {
chan->callid = ast_callid_unref(chan->callid);
}
chan->callid = 0;
}
/* Typedef accessors */