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
1.6.0
Olle Johansson 19 years ago
parent f9f8237a2f
commit 063ebdf279

@ -2446,9 +2446,11 @@ static void sip_destroy_peer(struct sip_peer *peer)
ast_free_ha(peer->ha); ast_free_ha(peer->ha);
if (ast_test_flag(&peer->flags[1], SIP_PAGE2_SELFDESTRUCT)) if (ast_test_flag(&peer->flags[1], SIP_PAGE2_SELFDESTRUCT))
apeerobjs--; apeerobjs--;
else if (ast_test_flag(&peer->flags[0], SIP_REALTIME)) else if (ast_test_flag(&peer->flags[0], SIP_REALTIME)) {
rpeerobjs--; 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--; speerobjs--;
clear_realm_authentication(peer->auth); clear_realm_authentication(peer->auth);
peer->auth = NULL; peer->auth = NULL;
@ -2510,6 +2512,7 @@ static struct sip_peer *realtime_peer(const char *newpeername, struct sockaddr_i
return NULL; return NULL;
} }
/* Peer found in realtime, now build it in memory */ /* Peer found in realtime, now build it in memory */
peer = build_peer(newpeername, var, NULL, !ast_test_flag(&global_flags[1], SIP_PAGE2_RTCACHEFRIENDS)); peer = build_peer(newpeername, var, NULL, !ast_test_flag(&global_flags[1], SIP_PAGE2_RTCACHEFRIENDS));
if (!peer) { if (!peer) {
@ -2517,6 +2520,9 @@ static struct sip_peer *realtime_peer(const char *newpeername, struct sockaddr_i
return NULL; 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)) { if (ast_test_flag(&global_flags[1], SIP_PAGE2_RTCACHEFRIENDS)) {
/* Cache peer */ /* Cache peer */
ast_copy_flags(&peer->flags[1],&global_flags[1], SIP_PAGE2_RTAUTOCLEAR|SIP_PAGE2_RTCACHEFRIENDS); 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? /* Do we need to release this peer from memory?
Only for realtime peers and autocreated peers 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) || if (ast_test_flag(&peer->flags[1], SIP_PAGE2_SELFDESTRUCT) ||
ast_test_flag(&peer->flags[1], SIP_PAGE2_RTAUTOCLEAR)) { ast_test_flag(&peer->flags[1], SIP_PAGE2_RTAUTOCLEAR)) {
peer = ASTOBJ_CONTAINER_UNLINK(&peerl, peer); /* Remove from peer list */ 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)))) if (!(peer = ast_calloc(1, sizeof(*peer))))
return NULL; return NULL;
if (realtime) if (realtime) {
rpeerobjs++; rpeerobjs++;
else if (option_debug > 2)
ast_log(LOG_DEBUG,"-REALTIME- peer built. Name: %s. Peer objects: %d\n", peer->name, rpeerobjs);
} else
speerobjs++; speerobjs++;
ASTOBJ_INIT(peer); ASTOBJ_INIT(peer);
} }

Loading…
Cancel
Save