diff options
author | Matthias Wachs <wachs@net.in.tum.de> | 2014-04-30 16:49:38 +0000 |
---|---|---|
committer | Matthias Wachs <wachs@net.in.tum.de> | 2014-04-30 16:49:38 +0000 |
commit | f5743f7009ec5ab505963b7cf4338917caa136d1 (patch) | |
tree | 69fbf4d778b9961c3f1e4f9c1fc227cb898d4246 /src | |
parent | df775d9bd009286b42212fecf995cf3b1865a39a (diff) | |
download | gnunet-f5743f7009ec5ab505963b7cf4338917caa136d1.tar.gz gnunet-f5743f7009ec5ab505963b7cf4338917caa136d1.zip |
fixing file handle lookup
one type to store them all
Diffstat (limited to 'src')
-rw-r--r-- | src/ats/gnunet-ats-solver-eval.c | 18 | ||||
-rw-r--r-- | src/ats/gnunet-ats-solver-eval.h | 21 |
2 files changed, 21 insertions, 18 deletions
diff --git a/src/ats/gnunet-ats-solver-eval.c b/src/ats/gnunet-ats-solver-eval.c index 6e8a4b5dd..57e9ce69f 100644 --- a/src/ats/gnunet-ats-solver-eval.c +++ b/src/ats/gnunet-ats-solver-eval.c | |||
@@ -194,7 +194,7 @@ GNUNET_ATS_solver_logging_now (struct LoggingHandle *l) | |||
194 | /* Store logging data here */ | 194 | /* Store logging data here */ |
195 | for (cur = peer_head; NULL != cur; cur = cur->next) | 195 | for (cur = peer_head; NULL != cur; cur = cur->next) |
196 | { | 196 | { |
197 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Logging peer id %u\n", cur->peer_id); | 197 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Logging peer id %llu\n", cur->id); |
198 | 198 | ||
199 | log_p = GNUNET_new (struct LoggingPeer); | 199 | log_p = GNUNET_new (struct LoggingPeer); |
200 | log_p->id = cur->id; | 200 | log_p->id = cur->id; |
@@ -211,7 +211,8 @@ GNUNET_ATS_solver_logging_now (struct LoggingHandle *l) | |||
211 | 211 | ||
212 | for (cur_addr = cur->addr_head; NULL != cur_addr; cur_addr = cur_addr->next) | 212 | for (cur_addr = cur->addr_head; NULL != cur_addr; cur_addr = cur_addr->next) |
213 | { | 213 | { |
214 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Logging peer id %u address %u\n", cur->peer_id, cur_addr->aid); | 214 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Logging peer id %llu address %llu\n", |
215 | cur->peer_id, cur_addr->aid); | ||
215 | log_a = GNUNET_new (struct LoggingAddress); | 216 | log_a = GNUNET_new (struct LoggingAddress); |
216 | log_a->aid = cur_addr->aid; | 217 | log_a->aid = cur_addr->aid; |
217 | log_a->active = cur_addr->ats_addr->active; | 218 | log_a->active = cur_addr->ats_addr->active; |
@@ -231,7 +232,7 @@ GNUNET_ATS_solver_logging_now (struct LoggingHandle *l) | |||
231 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "\t BW in = %llu\n", ntohl(log_a->assigned_bw_in.value__)); | 232 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "\t BW in = %llu\n", ntohl(log_a->assigned_bw_in.value__)); |
232 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "\t BW out = %llu\n", ntohl(log_a->assigned_bw_out.value__)); | 233 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "\t BW out = %llu\n", ntohl(log_a->assigned_bw_out.value__)); |
233 | 234 | ||
234 | GNUNET_CONTAINER_DLL_insert_tail(log_p->addr_head, log_p->addr_tail, log_a); | 235 | GNUNET_CONTAINER_DLL_insert_tail (log_p->addr_head, log_p->addr_tail, log_a); |
235 | } | 236 | } |
236 | } | 237 | } |
237 | } | 238 | } |
@@ -280,7 +281,7 @@ find_logging_file_handle (struct LoggingFileHandle *lf_head, | |||
280 | struct LoggingFileHandle *res; | 281 | struct LoggingFileHandle *res; |
281 | 282 | ||
282 | for (res = lf_head; NULL != res; res = res->next) | 283 | for (res = lf_head; NULL != res; res = res->next) |
283 | if ((res->pid == peer_id) && (res->pid == address_id)) | 284 | if ((res->pid == peer_id) && (res->aid == address_id)) |
284 | return res; | 285 | return res; |
285 | return NULL; | 286 | return NULL; |
286 | 287 | ||
@@ -361,7 +362,7 @@ GNUNET_ATS_solver_logging_write_to_disk (struct LoggingHandle *l, int add_time_s | |||
361 | cur->aid, | 362 | cur->aid, |
362 | cur->pid); | 363 | cur->pid); |
363 | 364 | ||
364 | fprintf (stderr, "Add writing log data for %i %i to file `%s'\n", | 365 | fprintf (stderr, "Add writing log data for %llu %llu to file `%s'\n", |
365 | cur->pid, cur->aid, filename); | 366 | cur->pid, cur->aid, filename); |
366 | 367 | ||
367 | 368 | ||
@@ -472,7 +473,7 @@ GNUNET_ATS_solver_logging_eval (struct LoggingHandle *l) | |||
472 | 473 | ||
473 | for (log_p = lts->head; NULL != log_p; log_p = log_p->next) | 474 | for (log_p = lts->head; NULL != log_p; log_p = log_p->next) |
474 | { | 475 | { |
475 | fprintf (stderr,"\tLogging peer pid %u\n", log_p->id); | 476 | fprintf (stderr,"\tLogging peer pid %llu\n", log_p->id); |
476 | for (c = 1; c < GNUNET_ATS_PreferenceCount; c++) | 477 | for (c = 1; c < GNUNET_ATS_PreferenceCount; c++) |
477 | { | 478 | { |
478 | fprintf(stderr,"\t %s = %.2f %.2f [abs/rel]\n", | 479 | fprintf(stderr,"\t %s = %.2f %.2f [abs/rel]\n", |
@@ -482,7 +483,7 @@ GNUNET_ATS_solver_logging_eval (struct LoggingHandle *l) | |||
482 | 483 | ||
483 | for (log_a = log_p->addr_head; NULL != log_a; log_a = log_a->next) | 484 | for (log_a = log_p->addr_head; NULL != log_a; log_a = log_a->next) |
484 | { | 485 | { |
485 | fprintf (stderr, "\tPeer pid %u address %u: %u %u %u\n", | 486 | fprintf (stderr, "\tPeer pid %llu address %llu: %u %u %u\n", |
486 | log_p->id, log_a->aid, log_a->active, | 487 | log_p->id, log_a->aid, log_a->active, |
487 | ntohl(log_a->assigned_bw_in.value__), | 488 | ntohl(log_a->assigned_bw_in.value__), |
488 | ntohl(log_a->assigned_bw_out.value__)); | 489 | ntohl(log_a->assigned_bw_out.value__)); |
@@ -2074,11 +2075,12 @@ enforce_add_address (struct GNUNET_ATS_TEST_Operation *op) | |||
2074 | 2075 | ||
2075 | a = GNUNET_new (struct TestAddress); | 2076 | a = GNUNET_new (struct TestAddress); |
2076 | a->aid = op->address_id; | 2077 | a->aid = op->address_id; |
2078 | fprintf (stderr, "XXXX : %llu %llu \n", a->aid, op->address_id); | ||
2077 | a->network = op->address_network; | 2079 | a->network = op->address_network; |
2078 | a->ats_addr = create_ats_address (&p->peer_id, op->plugin, op->address, | 2080 | a->ats_addr = create_ats_address (&p->peer_id, op->plugin, op->address, |
2079 | strlen (op->address) + 1, op->address_session); | 2081 | strlen (op->address) + 1, op->address_session); |
2080 | memset (&p->peer_id, op->peer_id, sizeof (p->peer_id)); | 2082 | memset (&p->peer_id, op->peer_id, sizeof (p->peer_id)); |
2081 | GNUNET_CONTAINER_DLL_insert (p->addr_head, p->addr_tail, a); | 2083 | GNUNET_CONTAINER_DLL_insert_tail (p->addr_head, p->addr_tail, a); |
2082 | 2084 | ||
2083 | for (c = 0; c < GNUNET_ATS_PropertyCount; c++) | 2085 | for (c = 0; c < GNUNET_ATS_PropertyCount; c++) |
2084 | a->prop_norm[c] = DEFAULT_REL_QUALITY; | 2086 | a->prop_norm[c] = DEFAULT_REL_QUALITY; |
diff --git a/src/ats/gnunet-ats-solver-eval.h b/src/ats/gnunet-ats-solver-eval.h index 6a4220685..05c3c89ff 100644 --- a/src/ats/gnunet-ats-solver-eval.h +++ b/src/ats/gnunet-ats-solver-eval.h | |||
@@ -92,10 +92,10 @@ struct LoggingFileHandle | |||
92 | struct LoggingFileHandle *prev; | 92 | struct LoggingFileHandle *prev; |
93 | 93 | ||
94 | /* peer id */ | 94 | /* peer id */ |
95 | int pid; | 95 | long long unsigned int pid; |
96 | 96 | ||
97 | /* address id */ | 97 | /* address id */ |
98 | int aid; | 98 | long long unsigned int aid; |
99 | 99 | ||
100 | struct GNUNET_DISK_FileHandle *f_hd; | 100 | struct GNUNET_DISK_FileHandle *f_hd; |
101 | 101 | ||
@@ -118,7 +118,7 @@ struct LoggingPeer | |||
118 | struct LoggingPeer *prev; | 118 | struct LoggingPeer *prev; |
119 | struct LoggingPeer *next; | 119 | struct LoggingPeer *next; |
120 | 120 | ||
121 | int id; | 121 | long long unsigned int id; |
122 | struct GNUNET_PeerIdentity peer_id; | 122 | struct GNUNET_PeerIdentity peer_id; |
123 | double pref_abs[GNUNET_ATS_PreferenceCount]; | 123 | double pref_abs[GNUNET_ATS_PreferenceCount]; |
124 | double pref_norm[GNUNET_ATS_PreferenceCount]; | 124 | double pref_norm[GNUNET_ATS_PreferenceCount]; |
@@ -132,7 +132,7 @@ struct LoggingAddress | |||
132 | struct LoggingAddress *next; | 132 | struct LoggingAddress *next; |
133 | struct LoggingAddress *prev; | 133 | struct LoggingAddress *prev; |
134 | 134 | ||
135 | int aid; | 135 | long long unsigned int aid; |
136 | int active; | 136 | int active; |
137 | int used; | 137 | int used; |
138 | uint32_t network; | 138 | uint32_t network; |
@@ -149,7 +149,7 @@ struct TestPeer | |||
149 | struct TestPeer *prev; | 149 | struct TestPeer *prev; |
150 | struct TestPeer *next; | 150 | struct TestPeer *next; |
151 | 151 | ||
152 | int id; | 152 | long long unsigned int id; |
153 | struct GNUNET_PeerIdentity peer_id; | 153 | struct GNUNET_PeerIdentity peer_id; |
154 | 154 | ||
155 | double pref_abs[GNUNET_ATS_PreferenceCount]; | 155 | double pref_abs[GNUNET_ATS_PreferenceCount]; |
@@ -165,7 +165,7 @@ struct TestAddress | |||
165 | struct TestAddress *next; | 165 | struct TestAddress *next; |
166 | struct TestAddress *prev; | 166 | struct TestAddress *prev; |
167 | 167 | ||
168 | int aid; | 168 | long long unsigned int aid; |
169 | struct ATS_Address *ats_addr; | 169 | struct ATS_Address *ats_addr; |
170 | uint32_t network; | 170 | uint32_t network; |
171 | 171 | ||
@@ -194,8 +194,9 @@ struct GNUNET_ATS_TEST_Operation | |||
194 | long long unsigned int address_id; | 194 | long long unsigned int address_id; |
195 | long long unsigned int peer_id; | 195 | long long unsigned int peer_id; |
196 | long long unsigned int client_id; | 196 | long long unsigned int client_id; |
197 | |||
197 | long long unsigned int address_session; | 198 | long long unsigned int address_session; |
198 | long long unsigned int address_network; | 199 | unsigned int address_network; |
199 | char*address; | 200 | char*address; |
200 | char*plugin; | 201 | char*plugin; |
201 | 202 | ||
@@ -263,7 +264,7 @@ struct PreferenceGenerator | |||
263 | 264 | ||
264 | enum GeneratorType type; | 265 | enum GeneratorType type; |
265 | 266 | ||
266 | unsigned int peer; | 267 | long long unsigned int peer; |
267 | unsigned int client_id; | 268 | unsigned int client_id; |
268 | 269 | ||
269 | enum GNUNET_ATS_PreferenceKind kind; | 270 | enum GNUNET_ATS_PreferenceKind kind; |
@@ -286,8 +287,8 @@ struct PropertyGenerator | |||
286 | 287 | ||
287 | enum GeneratorType type; | 288 | enum GeneratorType type; |
288 | 289 | ||
289 | unsigned int peer; | 290 | long long unsigned int peer; |
290 | unsigned int address_id; | 291 | long long unsigned int address_id; |
291 | 292 | ||
292 | struct TestPeer *test_peer; | 293 | struct TestPeer *test_peer; |
293 | struct TestAddress *test_address; | 294 | struct TestAddress *test_address; |