@ -469,7 +469,9 @@ static void aji_log_hook(void *data, const char *xmpp, size_t size, int is_incom
/*!
/*!
* \ brief The action hook parses the inbound packets , constantly running .
* \ brief The action hook parses the inbound packets , constantly running .
* \ param aji client structure , type of packet , the actual packet .
* \ param data aji client structure
* \ param type type of packet
* \ param node the actual packet .
* \ return IKS_OK or IKS_HOOK .
* \ return IKS_OK or IKS_HOOK .
*/
*/
static int aji_act_hook ( void * data , int type , iks * node )
static int aji_act_hook ( void * data , int type , iks * node )
@ -484,6 +486,11 @@ static int aji_act_hook(void *data, int type, iks *node)
return IKS_HOOK ;
return IKS_HOOK ;
}
}
if ( client - > state = = AJI_DISCONNECTING ) {
ASTOBJ_UNREF ( client , aji_client_destroy ) ;
return IKS_HOOK ;
}
pak = iks_packet ( node ) ;
pak = iks_packet ( node ) ;
if ( ! client - > component ) { /*client */
if ( ! client - > component ) { /*client */
@ -1511,6 +1518,12 @@ static void *aji_recv_loop(void *data)
}
}
res = iks_recv ( client - > p , 1 ) ;
res = iks_recv ( client - > p , 1 ) ;
if ( client - > state = = AJI_DISCONNECTING ) {
if ( option_debug > 1 )
ast_log ( LOG_DEBUG , " Ending our Jabber client's thread due to a disconnect \n " ) ;
pthread_exit ( NULL ) ;
}
client - > timeout - - ;
client - > timeout - - ;
if ( res = = IKS_HOOK )
if ( res = = IKS_HOOK )
ast_log ( LOG_WARNING , " JABBER: Got hook event. \n " ) ;
ast_log ( LOG_WARNING , " JABBER: Got hook event. \n " ) ;
@ -2380,9 +2393,9 @@ static int unload_module(void)
ast_manager_unregister ( " JabberSend " ) ;
ast_manager_unregister ( " JabberSend " ) ;
ASTOBJ_CONTAINER_TRAVERSE ( & clients , 1 , {
ASTOBJ_CONTAINER_TRAVERSE ( & clients , 1 , {
ASTOBJ_RDLOCK ( iterator ) ;
ASTOBJ_RDLOCK ( iterator ) ;
if ( option_ verbose > 2 )
if ( option_ debug > 2 )
ast_ verbose( VERBOSE_PREFIX_3 " JABBER : %s\n " , iterator - > name ) ;
ast_ log( LOG_DEBUG , " JABBER: Releasing and disconneing client : %s\n " , iterator - > name ) ;
iterator - > state = AJI_DISCONNECT ED ;
iterator - > state = AJI_DISCONNECT ING ;
ast_aji_disconnect ( iterator ) ;
ast_aji_disconnect ( iterator ) ;
pthread_join ( iterator - > thread , NULL ) ;
pthread_join ( iterator - > thread , NULL ) ;
ASTOBJ_UNLOCK ( iterator ) ;
ASTOBJ_UNLOCK ( iterator ) ;
@ -2390,8 +2403,6 @@ static int unload_module(void)
ASTOBJ_CONTAINER_DESTROYALL ( & clients , aji_client_destroy ) ;
ASTOBJ_CONTAINER_DESTROYALL ( & clients , aji_client_destroy ) ;
ASTOBJ_CONTAINER_DESTROY ( & clients ) ;
ASTOBJ_CONTAINER_DESTROY ( & clients ) ;
ast_log ( LOG_NOTICE , " res_jabber unloaded. \n " ) ;
return 0 ;
return 0 ;
}
}
@ -2406,7 +2417,6 @@ static int load_module(void)
ast_register_application ( app_ajistatus , aji_status_exec , ajistatus_synopsis , ajistatus_descrip ) ;
ast_register_application ( app_ajistatus , aji_status_exec , ajistatus_synopsis , ajistatus_descrip ) ;
ast_cli_register_multiple ( aji_cli , sizeof ( aji_cli ) / sizeof ( struct ast_cli_entry ) ) ;
ast_cli_register_multiple ( aji_cli , sizeof ( aji_cli ) / sizeof ( struct ast_cli_entry ) ) ;
ast_log ( LOG_NOTICE , " res_jabber.so loaded. \n " ) ;
return 0 ;
return 0 ;
}
}