summaryrefslogtreecommitdiff
path: root/channels/chan_sip.c
diff options
context:
space:
mode:
authorOlle Johansson <oej@edvina.net>2006-11-14 13:17:38 +0000
committerOlle Johansson <oej@edvina.net>2006-11-14 13:17:38 +0000
commit063ebdf2799ff7f0b4c5ec43c85ee553e06a5f9b (patch)
treedba92452e6978be8a937ad3b71963e603224b582 /channels/chan_sip.c
parentf9f8237a2fbe57a523971d41a7b45cd9ccce0f83 (diff)
Adding some debug output to trace bug in realtime
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@47600 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'channels/chan_sip.c')
-rw-r--r--channels/chan_sip.c19
1 files changed, 15 insertions, 4 deletions
diff --git a/channels/chan_sip.c b/channels/chan_sip.c
index 718de16e3..74da5883a 100644
--- a/channels/chan_sip.c
+++ b/channels/chan_sip.c
@@ -2446,9 +2446,11 @@ static void sip_destroy_peer(struct sip_peer *peer)
ast_free_ha(peer->ha);
if (ast_test_flag(&peer->flags[1], SIP_PAGE2_SELFDESTRUCT))
apeerobjs--;
- else if (ast_test_flag(&peer->flags[0], SIP_REALTIME))
+ else if (ast_test_flag(&peer->flags[0], SIP_REALTIME)) {
rpeerobjs--;
- else
+ if (option_debug > 2)
+ ast_log(LOG_DEBUG,"-REALTIME- peer Destroyed. Name: %s. Realtime Peer objects: %d\n", peer->name, rpeerobjs);
+ } else
speerobjs--;
clear_realm_authentication(peer->auth);
peer->auth = NULL;
@@ -2510,6 +2512,7 @@ static struct sip_peer *realtime_peer(const char *newpeername, struct sockaddr_i
return NULL;
}
+
/* Peer found in realtime, now build it in memory */
peer = build_peer(newpeername, var, NULL, !ast_test_flag(&global_flags[1], SIP_PAGE2_RTCACHEFRIENDS));
if (!peer) {
@@ -2517,6 +2520,9 @@ static struct sip_peer *realtime_peer(const char *newpeername, struct sockaddr_i
return NULL;
}
+ if (option_debug > 2)
+ ast_log(LOG_DEBUG,"-REALTIME- loading peer from database to memory. Name: %s. Peer objects: %d\n", peer->name, rpeerobjs);
+
if (ast_test_flag(&global_flags[1], SIP_PAGE2_RTCACHEFRIENDS)) {
/* Cache peer */
ast_copy_flags(&peer->flags[1],&global_flags[1], SIP_PAGE2_RTAUTOCLEAR|SIP_PAGE2_RTCACHEFRIENDS);
@@ -7529,6 +7535,9 @@ static int expire_register(void *data)
/* Do we need to release this peer from memory?
Only for realtime peers and autocreated peers
*/
+ if (option_debug > 2 && ast_test_flag(&peer->flags[0], SIP_REALTIME))
+ ast_log(LOG_DEBUG,"-REALTIME- peer expired registration. Name: %s. Realtime peer objects now %d\n", peer->name, rpeerobjs);
+
if (ast_test_flag(&peer->flags[1], SIP_PAGE2_SELFDESTRUCT) ||
ast_test_flag(&peer->flags[1], SIP_PAGE2_RTAUTOCLEAR)) {
peer = ASTOBJ_CONTAINER_UNLINK(&peerl, peer); /* Remove from peer list */
@@ -15755,9 +15764,11 @@ static struct sip_peer *build_peer(const char *name, struct ast_variable *v, str
if (!(peer = ast_calloc(1, sizeof(*peer))))
return NULL;
- if (realtime)
+ if (realtime) {
rpeerobjs++;
- else
+ if (option_debug > 2)
+ ast_log(LOG_DEBUG,"-REALTIME- peer built. Name: %s. Peer objects: %d\n", peer->name, rpeerobjs);
+ } else
speerobjs++;
ASTOBJ_INIT(peer);
}