diff options
author | Matthias Wachs <wachs@net.in.tum.de> | 2013-07-05 12:17:07 +0000 |
---|---|---|
committer | Matthias Wachs <wachs@net.in.tum.de> | 2013-07-05 12:17:07 +0000 |
commit | 510a2a8ba07d13a1ee5b1aef3e9a9e8b542acb98 (patch) | |
tree | f32a34a68a2e5194eb84580307638e09f2f09348 /src/ats | |
parent | 5df01bf127e8f641c3ae75445c4822ad4ca09774 (diff) | |
download | gnunet-510a2a8ba07d13a1ee5b1aef3e9a9e8b542acb98.tar.gz gnunet-510a2a8ba07d13a1ee5b1aef3e9a9e8b542acb98.zip |
documentation + remove unused code
Diffstat (limited to 'src/ats')
-rw-r--r-- | src/ats/gnunet-service-ats-solver_mlp.c | 104 | ||||
-rw-r--r-- | src/ats/gnunet-service-ats-solver_mlp.h | 42 | ||||
-rw-r--r-- | src/ats/gnunet-service-ats_addresses.c | 3 |
3 files changed, 83 insertions, 66 deletions
diff --git a/src/ats/gnunet-service-ats-solver_mlp.c b/src/ats/gnunet-service-ats-solver_mlp.c index 2a35f574e..24fe8e0ac 100644 --- a/src/ats/gnunet-service-ats-solver_mlp.c +++ b/src/ats/gnunet-service-ats-solver_mlp.c | |||
@@ -1179,65 +1179,15 @@ GAS_mlp_address_add (void *solver, | |||
1179 | } | 1179 | } |
1180 | 1180 | ||
1181 | 1181 | ||
1182 | #if 0 | 1182 | /** |
1183 | /* Check for network update */ | 1183 | * Transport properties for this address have changed |
1184 | if (type == GNUNET_ATS_NETWORK_TYPE) | 1184 | * |
1185 | { | 1185 | * @param solver solver handle |
1186 | new_value = get_performance_info (address, GNUNET_ATS_NETWORK_TYPE); | 1186 | * @param address the address |
1187 | if (GNUNET_ATS_VALUE_UNDEFINED == new_value) | 1187 | * @param type the ATSI type in HBO |
1188 | new_value = GNUNET_ATS_NET_UNSPECIFIED; | 1188 | * @param abs_value the absolute value of the property |
1189 | if (new_value != prev_value) | 1189 | * @param rel_value the normalized value |
1190 | { | 1190 | */ |
1191 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Updating network for peer `%s' from `%s' to `%s'\n", | ||
1192 | GNUNET_i2s (&address->peer), | ||
1193 | GNUNET_ATS_print_network_type(prev_value), | ||
1194 | GNUNET_ATS_print_network_type(new_value)); | ||
1195 | } | ||
1196 | |||
1197 | if (mlpi->c_b == MLP_UNDEFINED) | ||
1198 | continue; /* This address is not yet in the matrix*/ | ||
1199 | |||
1200 | rows = glp_get_num_rows(mlp->p.prob); | ||
1201 | ind = GNUNET_malloc (rows * sizeof (int) + 1); | ||
1202 | val = GNUNET_malloc (rows * sizeof (double) + 1); | ||
1203 | int length = glp_get_mat_col (mlp->p.prob, mlpi->c_b, ind, val); | ||
1204 | |||
1205 | for (c_net = 0; c_net <= length + 1; c_net ++) | ||
1206 | { | ||
1207 | if (ind[c_net] == mlp->p.r_quota[prev_value]) | ||
1208 | break; /* Found index for old network */ | ||
1209 | } | ||
1210 | val[c_net] = 0.0; | ||
1211 | glp_set_mat_col (mlp->p.prob, mlpi->c_b, length, ind, val); | ||
1212 | /* Set updated column */ | ||
1213 | ind[c_net] = mlp->p.r_quota[new_value]; | ||
1214 | val[c_net] = 1.0; | ||
1215 | glp_set_mat_col (mlp->p.prob, mlpi->c_b, length, ind, val); | ||
1216 | GNUNET_free (ind); | ||
1217 | GNUNET_free (val); | ||
1218 | |||
1219 | rows = glp_get_num_rows(mlp->p.prob); | ||
1220 | ind = GNUNET_malloc (rows * sizeof (int) + 1); | ||
1221 | val = GNUNET_malloc (rows * sizeof (double) + 1); | ||
1222 | length = glp_get_mat_col (mlp->p.prob, mlpi->c_b, ind, val); | ||
1223 | |||
1224 | for (c_net = 0; c_net <= length + 1; c_net ++) | ||
1225 | { | ||
1226 | if (ind[c_net] == mlp->p.r_quota[prev_value]) | ||
1227 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Removing old network index [%u] == [%f]\n",ind[c_net],val[c_net]); | ||
1228 | if (ind[c_net] == mlp->p.r_quota[new_value]) | ||
1229 | { | ||
1230 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Setting new network index [%u] == [%f]\n",ind[c_net],val[c_net]); | ||
1231 | break; | ||
1232 | } | ||
1233 | } | ||
1234 | GNUNET_free (ind); | ||
1235 | GNUNET_free (val); | ||
1236 | mlp->mlp_prob_changed = GNUNET_YES; | ||
1237 | continue; | ||
1238 | } | ||
1239 | #endif | ||
1240 | |||
1241 | void | 1191 | void |
1242 | GAS_mlp_address_property_changed (void *solver, | 1192 | GAS_mlp_address_property_changed (void *solver, |
1243 | struct ATS_Address *address, | 1193 | struct ATS_Address *address, |
@@ -1309,6 +1259,16 @@ GAS_mlp_address_property_changed (void *solver, | |||
1309 | } | 1259 | } |
1310 | 1260 | ||
1311 | 1261 | ||
1262 | /** | ||
1263 | * Transport session for this address has changed | ||
1264 | * | ||
1265 | * NOTE: values in addresses are already updated | ||
1266 | * | ||
1267 | * @param solver solver handle | ||
1268 | * @param address the address | ||
1269 | * @param cur_session the current session | ||
1270 | * @param new_session the new session | ||
1271 | */ | ||
1312 | void | 1272 | void |
1313 | GAS_mlp_address_session_changed (void *solver, | 1273 | GAS_mlp_address_session_changed (void *solver, |
1314 | struct ATS_Address *address, | 1274 | struct ATS_Address *address, |
@@ -1319,6 +1279,17 @@ GAS_mlp_address_session_changed (void *solver, | |||
1319 | return; | 1279 | return; |
1320 | } | 1280 | } |
1321 | 1281 | ||
1282 | |||
1283 | /** | ||
1284 | * Transport session for this address has changed | ||
1285 | * | ||
1286 | * NOTE: values in addresses are already updated | ||
1287 | * | ||
1288 | * @param solver solver handle | ||
1289 | * @param address the address | ||
1290 | * @param cur_session the current session | ||
1291 | * @param new_session the new session | ||
1292 | */ | ||
1322 | void | 1293 | void |
1323 | GAS_mlp_address_inuse_changed (void *solver, | 1294 | GAS_mlp_address_inuse_changed (void *solver, |
1324 | struct ATS_Address *address, | 1295 | struct ATS_Address *address, |
@@ -1330,6 +1301,16 @@ GAS_mlp_address_inuse_changed (void *solver, | |||
1330 | } | 1301 | } |
1331 | 1302 | ||
1332 | 1303 | ||
1304 | /** | ||
1305 | * Network scope for this address has changed | ||
1306 | * | ||
1307 | * NOTE: values in addresses are already updated | ||
1308 | * | ||
1309 | * @param solver solver handle | ||
1310 | * @param address the address | ||
1311 | * @param current_network the current network | ||
1312 | * @param new_network the new network | ||
1313 | */ | ||
1333 | void | 1314 | void |
1334 | GAS_mlp_address_change_network (void *solver, | 1315 | GAS_mlp_address_change_network (void *solver, |
1335 | struct ATS_Address *address, | 1316 | struct ATS_Address *address, |
@@ -1341,11 +1322,6 @@ GAS_mlp_address_change_network (void *solver, | |||
1341 | struct ATS_Peer *p; | 1322 | struct ATS_Peer *p; |
1342 | int nets_avail[] = GNUNET_ATS_NetworkType; | 1323 | int nets_avail[] = GNUNET_ATS_NetworkType; |
1343 | int c1; | 1324 | int c1; |
1344 | // int length; | ||
1345 | // int rows; | ||
1346 | // int *ind; | ||
1347 | // double *val; | ||
1348 | |||
1349 | 1325 | ||
1350 | GNUNET_assert (NULL != solver); | 1326 | GNUNET_assert (NULL != solver); |
1351 | GNUNET_assert (NULL != address); | 1327 | GNUNET_assert (NULL != address); |
diff --git a/src/ats/gnunet-service-ats-solver_mlp.h b/src/ats/gnunet-service-ats-solver_mlp.h index 02bfcc945..960f63186 100644 --- a/src/ats/gnunet-service-ats-solver_mlp.h +++ b/src/ats/gnunet-service-ats-solver_mlp.h | |||
@@ -403,6 +403,16 @@ GAS_mlp_address_add (void *solver, | |||
403 | struct ATS_Address *address, | 403 | struct ATS_Address *address, |
404 | uint32_t network); | 404 | uint32_t network); |
405 | 405 | ||
406 | |||
407 | /** | ||
408 | * Transport properties for this address have changed | ||
409 | * | ||
410 | * @param solver solver handle | ||
411 | * @param address the address | ||
412 | * @param type the ATSI type in HBO | ||
413 | * @param abs_value the absolute value of the property | ||
414 | * @param rel_value the normalized value | ||
415 | */ | ||
406 | void | 416 | void |
407 | GAS_mlp_address_property_changed (void *solver, | 417 | GAS_mlp_address_property_changed (void *solver, |
408 | struct ATS_Address *address, | 418 | struct ATS_Address *address, |
@@ -411,18 +421,50 @@ GAS_mlp_address_property_changed (void *solver, | |||
411 | double rel_value); | 421 | double rel_value); |
412 | 422 | ||
413 | 423 | ||
424 | /** | ||
425 | * Transport session for this address has changed | ||
426 | * | ||
427 | * NOTE: values in addresses are already updated | ||
428 | * | ||
429 | * @param solver solver handle | ||
430 | * @param address the address | ||
431 | * @param cur_session the current session | ||
432 | * @param new_session the new session | ||
433 | */ | ||
414 | void | 434 | void |
415 | GAS_mlp_address_session_changed (void *solver, | 435 | GAS_mlp_address_session_changed (void *solver, |
416 | struct ATS_Address *address, | 436 | struct ATS_Address *address, |
417 | uint32_t cur_session, | 437 | uint32_t cur_session, |
418 | uint32_t new_session); | 438 | uint32_t new_session); |
419 | 439 | ||
440 | |||
441 | /** | ||
442 | * Transport session for this address has changed | ||
443 | * | ||
444 | * NOTE: values in addresses are already updated | ||
445 | * | ||
446 | * @param solver solver handle | ||
447 | * @param address the address | ||
448 | * @param cur_session the current session | ||
449 | * @param new_session the new session | ||
450 | */ | ||
420 | void | 451 | void |
421 | GAS_mlp_address_inuse_changed (void *solver, | 452 | GAS_mlp_address_inuse_changed (void *solver, |
422 | struct ATS_Address *address, | 453 | struct ATS_Address *address, |
423 | uint32_t session, | 454 | uint32_t session, |
424 | int in_use); | 455 | int in_use); |
425 | 456 | ||
457 | |||
458 | /** | ||
459 | * Network scope for this address has changed | ||
460 | * | ||
461 | * NOTE: values in addresses are already updated | ||
462 | * | ||
463 | * @param solver solver handle | ||
464 | * @param address the address | ||
465 | * @param current_network the current network | ||
466 | * @param new_network the new network | ||
467 | */ | ||
426 | void | 468 | void |
427 | GAS_mlp_address_change_network (void *solver, | 469 | GAS_mlp_address_change_network (void *solver, |
428 | struct ATS_Address *address, | 470 | struct ATS_Address *address, |
diff --git a/src/ats/gnunet-service-ats_addresses.c b/src/ats/gnunet-service-ats_addresses.c index 914729289..781ef2f8d 100644 --- a/src/ats/gnunet-service-ats_addresses.c +++ b/src/ats/gnunet-service-ats_addresses.c | |||
@@ -709,6 +709,7 @@ find_exact_address (struct GAS_Addresses_Handle *handle, | |||
709 | return ea; | 709 | return ea; |
710 | } | 710 | } |
711 | 711 | ||
712 | |||
712 | /** | 713 | /** |
713 | * Extract an ATS performance info from an address | 714 | * Extract an ATS performance info from an address |
714 | * | 715 | * |
@@ -734,8 +735,6 @@ get_performance_info (struct ATS_Address *address, uint32_t type) | |||
734 | } | 735 | } |
735 | 736 | ||
736 | 737 | ||
737 | |||
738 | |||
739 | /** | 738 | /** |
740 | * Add a new address for a peer. | 739 | * Add a new address for a peer. |
741 | * | 740 | * |