Archived
14
0
Fork 0

Adding some debug output to trace bug in realtime

git-svn-id: http://svn.digium.com/svn/asterisk/trunk@47600 f38db490-d61c-443f-a65b-d21fe96a405b
This commit is contained in:
oej 2006-11-14 13:17:38 +00:00
parent b59f34d960
commit 8426096bec

View file

@ -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);
}