diff options
author | Matthias Wachs <wachs@net.in.tum.de> | 2014-04-30 15:41:52 +0000 |
---|---|---|
committer | Matthias Wachs <wachs@net.in.tum.de> | 2014-04-30 15:41:52 +0000 |
commit | df775d9bd009286b42212fecf995cf3b1865a39a (patch) | |
tree | 1681ac9bc88992d5a721db1ad1e44572cb509953 /src | |
parent | 558d02c7542085ec7a3770511acce0533d0a7488 (diff) | |
download | gnunet-df775d9bd009286b42212fecf995cf3b1865a39a.tar.gz gnunet-df775d9bd009286b42212fecf995cf3b1865a39a.zip |
simplify definition of address delete: only peer id and address id is required
Diffstat (limited to 'src')
-rw-r--r-- | src/ats/gnunet-ats-solver-eval.c | 76 |
1 files changed, 7 insertions, 69 deletions
diff --git a/src/ats/gnunet-ats-solver-eval.c b/src/ats/gnunet-ats-solver-eval.c index a974962b8..6e8a4b5dd 100644 --- a/src/ats/gnunet-ats-solver-eval.c +++ b/src/ats/gnunet-ats-solver-eval.c | |||
@@ -1263,7 +1263,7 @@ load_op_del_address (struct GNUNET_ATS_TEST_Operation *o, | |||
1263 | const struct GNUNET_CONFIGURATION_Handle *cfg) | 1263 | const struct GNUNET_CONFIGURATION_Handle *cfg) |
1264 | { | 1264 | { |
1265 | char *op_name; | 1265 | char *op_name; |
1266 | char *op_network; | 1266 | //char *op_network; |
1267 | 1267 | ||
1268 | /* peer pid */ | 1268 | /* peer pid */ |
1269 | GNUNET_asprintf(&op_name, "op-%u-peer-id", op_counter); | 1269 | GNUNET_asprintf(&op_name, "op-%u-peer-id", op_counter); |
@@ -1289,6 +1289,7 @@ load_op_del_address (struct GNUNET_ATS_TEST_Operation *o, | |||
1289 | } | 1289 | } |
1290 | GNUNET_free (op_name); | 1290 | GNUNET_free (op_name); |
1291 | 1291 | ||
1292 | #if 0 | ||
1292 | /* plugin */ | 1293 | /* plugin */ |
1293 | GNUNET_asprintf(&op_name, "op-%u-plugin", op_counter); | 1294 | GNUNET_asprintf(&op_name, "op-%u-plugin", op_counter); |
1294 | if (GNUNET_SYSERR == GNUNET_CONFIGURATION_get_value_string (cfg, | 1295 | if (GNUNET_SYSERR == GNUNET_CONFIGURATION_get_value_string (cfg, |
@@ -1324,55 +1325,7 @@ load_op_del_address (struct GNUNET_ATS_TEST_Operation *o, | |||
1324 | return GNUNET_SYSERR; | 1325 | return GNUNET_SYSERR; |
1325 | } | 1326 | } |
1326 | GNUNET_free (op_name); | 1327 | GNUNET_free (op_name); |
1327 | 1328 | #endif | |
1328 | /* network */ | ||
1329 | GNUNET_asprintf(&op_name, "op-%u-address-network", op_counter); | ||
1330 | if (GNUNET_SYSERR == GNUNET_CONFIGURATION_get_value_string (cfg, | ||
1331 | sec_name, op_name, &op_network)) | ||
1332 | { | ||
1333 | fprintf (stderr, "Missing address-network in operation %u `%s' in episode `%s'\n", | ||
1334 | op_counter, "ADD_ADDRESS", op_name); | ||
1335 | GNUNET_free (op_name); | ||
1336 | return GNUNET_SYSERR; | ||
1337 | } | ||
1338 | else | ||
1339 | { | ||
1340 | GNUNET_STRINGS_utf8_toupper (op_network,op_network); | ||
1341 | if (0 == strcmp(op_network, "UNSPECIFIED")) | ||
1342 | { | ||
1343 | o->address_network = GNUNET_ATS_NET_UNSPECIFIED; | ||
1344 | } | ||
1345 | else if (0 == strcmp(op_network, "LOOPBACK")) | ||
1346 | { | ||
1347 | o->address_network = GNUNET_ATS_NET_LOOPBACK; | ||
1348 | } | ||
1349 | else if (0 == strcmp(op_network, "LAN")) | ||
1350 | { | ||
1351 | o->address_network = GNUNET_ATS_NET_LAN; | ||
1352 | } | ||
1353 | else if (0 == strcmp(op_network, "WAN")) | ||
1354 | { | ||
1355 | o->address_network = GNUNET_ATS_NET_WAN; | ||
1356 | } | ||
1357 | else if (0 == strcmp(op_network, "WLAN")) | ||
1358 | { | ||
1359 | o->address_network = GNUNET_ATS_NET_WLAN; | ||
1360 | } | ||
1361 | else if (0 == strcmp(op_network, "BT")) | ||
1362 | { | ||
1363 | o->address_network = GNUNET_ATS_NET_BT; | ||
1364 | } | ||
1365 | else | ||
1366 | { | ||
1367 | fprintf (stderr, "Invalid address-network in operation %u `%s' in episode `%s': `%s'\n", | ||
1368 | op_counter, "ADD_ADDRESS", op_name, op_network); | ||
1369 | GNUNET_free (op_network); | ||
1370 | GNUNET_free (op_name); | ||
1371 | return GNUNET_SYSERR; | ||
1372 | } | ||
1373 | } | ||
1374 | GNUNET_free (op_network); | ||
1375 | GNUNET_free (op_name); | ||
1376 | 1329 | ||
1377 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | 1330 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, |
1378 | "Found operation %s: [%llu:%llu] address `%s' plugin `%s' \n", | 1331 | "Found operation %s: [%llu:%llu] address `%s' plugin `%s' \n", |
@@ -2146,7 +2099,6 @@ enforce_del_address (struct GNUNET_ATS_TEST_Operation *op) | |||
2146 | { | 2099 | { |
2147 | struct TestPeer *p; | 2100 | struct TestPeer *p; |
2148 | struct TestAddress *a; | 2101 | struct TestAddress *a; |
2149 | struct AddressLookupCtx ctx; | ||
2150 | struct PropertyGenerator *pg; | 2102 | struct PropertyGenerator *pg; |
2151 | 2103 | ||
2152 | if (NULL == (p = find_peer_by_id (op->peer_id))) | 2104 | if (NULL == (p = find_peer_by_id (op->peer_id))) |
@@ -2157,19 +2109,6 @@ enforce_del_address (struct GNUNET_ATS_TEST_Operation *op) | |||
2157 | return; | 2109 | return; |
2158 | } | 2110 | } |
2159 | 2111 | ||
2160 | ctx.plugin = op->plugin; | ||
2161 | ctx.addr = op->address; | ||
2162 | ctx.res = NULL; | ||
2163 | GNUNET_CONTAINER_multipeermap_get_multiple (sh->addresses, &p->peer_id, | ||
2164 | find_address_it, &ctx); | ||
2165 | if (NULL == ctx.res) | ||
2166 | { | ||
2167 | GNUNET_break (0); | ||
2168 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | ||
2169 | "Deleting unknown address for peer %u\n", op->peer_id); | ||
2170 | return; | ||
2171 | } | ||
2172 | |||
2173 | if (NULL == (a =find_address_by_id (p, op->address_id))) | 2112 | if (NULL == (a =find_address_by_id (p, op->address_id))) |
2174 | { | 2113 | { |
2175 | GNUNET_break (0); | 2114 | GNUNET_break (0); |
@@ -2184,15 +2123,14 @@ enforce_del_address (struct GNUNET_ATS_TEST_Operation *op) | |||
2184 | } | 2123 | } |
2185 | 2124 | ||
2186 | GNUNET_CONTAINER_DLL_remove(p->addr_head, p->addr_tail, a); | 2125 | GNUNET_CONTAINER_DLL_remove(p->addr_head, p->addr_tail, a); |
2187 | GNUNET_free (a); | 2126 | GNUNET_CONTAINER_multipeermap_remove (sh->addresses, &p->peer_id, a->ats_addr); |
2188 | |||
2189 | GNUNET_CONTAINER_multipeermap_remove (sh->addresses, &p->peer_id, ctx.res); | ||
2190 | 2127 | ||
2191 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Removing address %u for peer %u\n", | 2128 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Removing address %u for peer %u\n", |
2192 | op->address_id, op->peer_id); | 2129 | op->address_id, op->peer_id); |
2193 | 2130 | ||
2194 | sh->env.sf.s_del (sh->solver, ctx.res, GNUNET_NO); | 2131 | sh->env.sf.s_del (sh->solver, a->ats_addr, GNUNET_NO); |
2195 | GNUNET_free (ctx.res); | 2132 | GNUNET_free (a->ats_addr); |
2133 | GNUNET_free (a); | ||
2196 | 2134 | ||
2197 | } | 2135 | } |
2198 | 2136 | ||