Mercurial > hg > freeDiameter
comparison extensions/app_radgw/rgw_clients.c @ 545:b0f9b0e1b564
Fix invalid initialization
author | Sebastien Decugis <sdecugis@nict.go.jp> |
---|---|
date | Tue, 14 Sep 2010 16:14:52 +0900 |
parents | a0e3af6f94fb |
children | 0790fcf2fbfc |
comparison
equal
deleted
inserted
replaced
544:a0e3af6f94fb | 545:b0f9b0e1b564 |
---|---|
134 free(r); | 134 free(r); |
135 } | 135 } |
136 | 136 |
137 /* The core of the purge thread */ | 137 /* The core of the purge thread */ |
138 static int dupl_purge_list(struct fd_list * clients) { | 138 static int dupl_purge_list(struct fd_list * clients) { |
139 | |
139 struct fd_list *li = NULL; | 140 struct fd_list *li = NULL; |
141 | |
140 for (li = clients->next; li != clients; li = li->next) { | 142 for (li = clients->next; li != clients; li = li->next) { |
141 struct rgw_client * client = (struct rgw_client *)li; | 143 struct rgw_client * client = (struct rgw_client *)li; |
142 int p; | 144 int p; |
145 | |
143 for (p=0; p<=1; p++) { | 146 for (p=0; p<=1; p++) { |
147 | |
144 /* Lock this list */ | 148 /* Lock this list */ |
145 time_t now; | 149 time_t now; |
146 CHECK_POSIX( pthread_mutex_lock(&client->dupl_info[p].dupl_lock) ); | 150 CHECK_POSIX( pthread_mutex_lock(&client->dupl_info[p].dupl_lock) ); |
147 | 151 |
148 now = time(NULL); | 152 now = time(NULL); |
149 | 153 |
150 while (!FD_IS_LIST_EMPTY(&client->dupl_info[p].dupl_by_time)) { | 154 while (!FD_IS_LIST_EMPTY(&client->dupl_info[p].dupl_by_time)) { |
155 | |
151 /* Check the first item in the list */ | 156 /* Check the first item in the list */ |
152 struct req_info * r = (struct req_info *)(client->dupl_info[p].dupl_by_time.next->o); | 157 struct req_info * r = (struct req_info *)(client->dupl_info[p].dupl_by_time.next->o); |
153 | 158 |
154 if (now - r->received > DUPLICATE_CHECK_LIFETIME) { | 159 if (now - r->received > DUPLICATE_CHECK_LIFETIME) { |
155 /* Remove this record */ | 160 /* Remove this record */ |
225 memset(tmp, 0, sizeof(struct rgw_client)); | 230 memset(tmp, 0, sizeof(struct rgw_client)); |
226 fd_list_init(&tmp->chain, NULL); | 231 fd_list_init(&tmp->chain, NULL); |
227 | 232 |
228 /* Initialize the duplicate list info */ | 233 /* Initialize the duplicate list info */ |
229 for (i=0; i<=1; i++) { | 234 for (i=0; i<=1; i++) { |
230 CHECK_POSIX( pthread_mutex_init(&tmp->dupl_info[0].dupl_lock, NULL) ); | 235 CHECK_POSIX( pthread_mutex_init(&tmp->dupl_info[i].dupl_lock, NULL) ); |
231 fd_list_init(&tmp->dupl_info[0].dupl_by_id, NULL); | 236 fd_list_init(&tmp->dupl_info[i].dupl_by_id, NULL); |
232 fd_list_init(&tmp->dupl_info[0].dupl_by_time, NULL); | 237 fd_list_init(&tmp->dupl_info[i].dupl_by_time, NULL); |
233 } | 238 } |
234 tmp->type = type; | 239 tmp->type = type; |
235 | 240 |
236 if (loc) { | 241 if (loc) { |
237 tmp->is_local = 1; | 242 tmp->is_local = 1; |