Changeset 1199:2c62bba0ef4b in freeDiameter for extensions
- Timestamp:
- Jun 14, 2013, 11:13:22 AM (11 years ago)
- Branch:
- default
- Phase:
- public
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/test_app/test_app.c
r1198 r1199 44 44 static struct ta_conf _conf; 45 45 static pthread_t ta_stats_th = (pthread_t)NULL; 46 static struct fd_hook_hdl * hookhdl = NULL;47 46 48 47 static int ta_conf_init(void) … … 137 136 } 138 137 139 static void ta_hook_cb(enum fd_hook_type type, struct msg * msg, struct peer_hdr * peer, void * other, struct fd_hook_permsgdata *pmd, void * regdata) { 140 138 static struct fd_hook_hdl * hookhdl[2] = { NULL, NULL }; 139 static void ta_hook_cb_silent(enum fd_hook_type type, struct msg * msg, struct peer_hdr * peer, void * other, struct fd_hook_permsgdata *pmd, void * regdata) { 140 } 141 static void ta_hook_cb_oneline(enum fd_hook_type type, struct msg * msg, struct peer_hdr * peer, void * other, struct fd_hook_permsgdata *pmd, void * regdata) { 142 char * buf = NULL; 143 size_t len; 144 145 CHECK_MALLOC_DO( fd_msg_dump_summary(&buf, &len, NULL, msg, NULL, 0, 0), 146 { LOG_E("Error while dumping a message"); return; } ); 147 148 LOG_N("{%d} %s: %s", type, (char *)other ?:"<nil>", buf ?:"<nil>"); 149 150 free(buf); 141 151 } 142 152 … … 180 190 if (ta_conf->mode & MODE_BENCH) { 181 191 /* Register an empty hook to disable the default handling */ 182 CHECK_FCT( fd_hook_register( HOOK_MASK( HOOK_DATA_RECEIVED, HOOK_MESSAGE_RECEIVED, HOOK_MESSAGE_LOCAL, HOOK_MESSAGE_SENT, HOOK_MESSAGE_FAILOVER, HOOK_MESSAGE_ROUTING_FORWARD, HOOK_MESSAGE_ROUTING_LOCAL ), 183 ta_hook_cb, NULL, NULL, &hookhdl) ); 192 CHECK_FCT( fd_hook_register( HOOK_MASK( HOOK_DATA_RECEIVED, HOOK_MESSAGE_RECEIVED, HOOK_MESSAGE_LOCAL, HOOK_MESSAGE_SENT, HOOK_MESSAGE_ROUTING_FORWARD, HOOK_MESSAGE_ROUTING_LOCAL ), 193 ta_hook_cb_silent, NULL, NULL, &hookhdl[0]) ); 194 CHECK_FCT( fd_hook_register( HOOK_MASK( HOOK_MESSAGE_ROUTING_ERROR, HOOK_MESSAGE_DROPPED ), 195 ta_hook_cb_oneline, NULL, NULL, &hookhdl[1]) ); 184 196 185 197 } … … 198 210 if (ta_conf->mode & MODE_SERV) 199 211 ta_serv_fini(); 200 if (hookhdl) 201 fd_hook_unregister( hookhdl ); 212 if (hookhdl[0]) 213 fd_hook_unregister( hookhdl[0] ); 214 if (hookhdl[1]) 215 fd_hook_unregister( hookhdl[1] ); 202 216 CHECK_FCT_DO( fd_thr_term(&ta_stats_th), ); 203 217 CHECK_POSIX_DO( pthread_mutex_destroy(&ta_conf->stats_lock), );
Note: See TracChangeset
for help on using the changeset viewer.