Mercurial > hg > freeDiameter
comparison extensions/rt_redirect/rt_redir.c @ 1259:82280e745a89
Remove whitespace at end of line.
author | Thomas Klausner <tk@giga.or.at> |
---|---|
date | Mon, 24 Mar 2014 13:13:38 +0100 |
parents | 4a9f08d6b6ba |
children | 4f6f61e67599 |
comparison
equal
deleted
inserted
replaced
1258:97caad40b665 | 1259:82280e745a89 |
---|---|
44 | 44 |
45 /* Initialize the module */ | 45 /* Initialize the module */ |
46 static int redir_entry(char * conffile) | 46 static int redir_entry(char * conffile) |
47 { | 47 { |
48 TRACE_ENTRY(""); | 48 TRACE_ENTRY(""); |
49 | 49 |
50 /* Dictionary objects */ | 50 /* Dictionary objects */ |
51 CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, DICT_AVP, AVP_BY_NAME, "Destination-Realm", &redir_dict_dr, ENOENT) ); | 51 CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, DICT_AVP, AVP_BY_NAME, "Destination-Realm", &redir_dict_dr, ENOENT) ); |
52 CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, DICT_AVP, AVP_BY_NAME, "User-Name", &redir_dict_un, ENOENT) ); | 52 CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, DICT_AVP, AVP_BY_NAME, "User-Name", &redir_dict_un, ENOENT) ); |
53 | 53 |
54 /* Initialize the entries array */ | 54 /* Initialize the entries array */ |
55 CHECK_FCT( redir_entry_init() ); | 55 CHECK_FCT( redir_entry_init() ); |
56 | 56 |
57 /* Start the expire thread */ | 57 /* Start the expire thread */ |
58 CHECK_POSIX( pthread_create( &exp_thr, NULL, redir_exp_thr_fct, NULL ) ); | 58 CHECK_POSIX( pthread_create( &exp_thr, NULL, redir_exp_thr_fct, NULL ) ); |
59 | 59 |
60 /* Register the callback that receives the answers and processes when it contains a Redirect indication. */ | 60 /* Register the callback that receives the answers and processes when it contains a Redirect indication. */ |
61 CHECK_FCT( fd_rt_fwd_register ( redir_fwd_cb, NULL, RT_FWD_ANS, &fwd_hdl ) ); | 61 CHECK_FCT( fd_rt_fwd_register ( redir_fwd_cb, NULL, RT_FWD_ANS, &fwd_hdl ) ); |
62 | 62 |
63 /* Register the callback that applies the saved Redirect rules to outgoing messages. */ | 63 /* Register the callback that applies the saved Redirect rules to outgoing messages. */ |
64 CHECK_FCT( fd_rt_out_register ( redir_out_cb, NULL, 10, &out_hdl ) ); | 64 CHECK_FCT( fd_rt_out_register ( redir_out_cb, NULL, 10, &out_hdl ) ); |
70 | 70 |
71 /* And terminate it */ | 71 /* And terminate it */ |
72 void fd_ext_fini(void) | 72 void fd_ext_fini(void) |
73 { | 73 { |
74 int i; | 74 int i; |
75 | 75 |
76 /* Unregister the callbacks */ | 76 /* Unregister the callbacks */ |
77 if (fwd_hdl) { | 77 if (fwd_hdl) { |
78 CHECK_FCT_DO( fd_rt_fwd_unregister(fwd_hdl, NULL), ); | 78 CHECK_FCT_DO( fd_rt_fwd_unregister(fwd_hdl, NULL), ); |
79 } | 79 } |
80 if (out_hdl) { | 80 if (out_hdl) { |
81 CHECK_FCT_DO( fd_rt_out_unregister(out_hdl, NULL), ); | 81 CHECK_FCT_DO( fd_rt_out_unregister(out_hdl, NULL), ); |
82 } | 82 } |
83 | 83 |
84 /* Stop the expiry thread */ | 84 /* Stop the expiry thread */ |
85 CHECK_FCT_DO( fd_thr_term(&exp_thr), ); | 85 CHECK_FCT_DO( fd_thr_term(&exp_thr), ); |
86 | 86 |
87 /* Empty all entries */ | 87 /* Empty all entries */ |
88 CHECK_POSIX_DO( pthread_mutex_lock(&redir_exp_peer_lock), ); | 88 CHECK_POSIX_DO( pthread_mutex_lock(&redir_exp_peer_lock), ); |
89 for (i = 0; i <= H_U_MAX; i++) { | 89 for (i = 0; i <= H_U_MAX; i++) { |
90 CHECK_POSIX_DO( pthread_rwlock_wrlock( &redirects_usages[i].lock), ); | 90 CHECK_POSIX_DO( pthread_rwlock_wrlock( &redirects_usages[i].lock), ); |
91 while (!FD_IS_LIST_EMPTY(&redirects_usages[i].sentinel)) { | 91 while (!FD_IS_LIST_EMPTY(&redirects_usages[i].sentinel)) { |
95 } | 95 } |
96 CHECK_POSIX_DO( pthread_rwlock_unlock( &redirects_usages[i].lock), ); | 96 CHECK_POSIX_DO( pthread_rwlock_unlock( &redirects_usages[i].lock), ); |
97 CHECK_POSIX_DO( pthread_rwlock_destroy( &redirects_usages[i].lock), ); | 97 CHECK_POSIX_DO( pthread_rwlock_destroy( &redirects_usages[i].lock), ); |
98 } | 98 } |
99 CHECK_POSIX_DO( pthread_mutex_unlock(&redir_exp_peer_lock), ); | 99 CHECK_POSIX_DO( pthread_mutex_unlock(&redir_exp_peer_lock), ); |
100 | 100 |
101 return; | 101 return; |
102 } | 102 } |