aboutsummaryrefslogtreecommitdiff
path: root/src/ats
diff options
context:
space:
mode:
authorMatthias Wachs <wachs@net.in.tum.de>2014-06-26 12:40:53 +0000
committerMatthias Wachs <wachs@net.in.tum.de>2014-06-26 12:40:53 +0000
commitefd282924f0742547a954410f1f9b16814de4fc1 (patch)
tree98f4bc2df232aff50512c772ca7408b5e45a7d12 /src/ats
parent0907017523af0870fad5ab36f1b04f1bef7a91c3 (diff)
downloadgnunet-efd282924f0742547a954410f1f9b16814de4fc1.tar.gz
gnunet-efd282924f0742547a954410f1f9b16814de4fc1.zip
fix fixmes
+ minor debug
Diffstat (limited to 'src/ats')
-rw-r--r--src/ats/plugin_ats_proportional.c49
1 files changed, 40 insertions, 9 deletions
diff --git a/src/ats/plugin_ats_proportional.c b/src/ats/plugin_ats_proportional.c
index de8e5a9c4..60ae7dfcb 100644
--- a/src/ats/plugin_ats_proportional.c
+++ b/src/ats/plugin_ats_proportional.c
@@ -352,12 +352,12 @@ struct Network
352 char *stat_active; 352 char *stat_active;
353 353
354 /** 354 /**
355 * FIXME. 355 * Linked list of addresses in this network: head
356 */ 356 */
357 struct AddressWrapper *head; 357 struct AddressWrapper *head;
358 358
359 /** 359 /**
360 * FIXME. 360 * Linked list of addresses in this network: tail
361 */ 361 */
362 struct AddressWrapper *tail; 362 struct AddressWrapper *tail;
363}; 363};
@@ -661,17 +661,24 @@ distribute_bandwidth (struct GAS_PROPORTIONAL_Handle *s,
661 661
662 662
663/** 663/**
664 * FIXME. 664 * Context for finding the best address* Linked list of addresses in this network: head
665 */ 665 */
666struct FindBestAddressCtx 666struct FindBestAddressCtx
667{ 667{
668 /**
669 * The solver handle
670 */
668 struct GAS_PROPORTIONAL_Handle *s; 671 struct GAS_PROPORTIONAL_Handle *s;
672
673 /**
674 * The currently best address
675 */
669 struct ATS_Address *best; 676 struct ATS_Address *best;
670}; 677};
671 678
672 679
673/** 680/**
674 * FIXME. 681 * Find index of a ATS property type in the array.
675 */ 682 */
676static int 683static int
677find_property_index (uint32_t type) 684find_property_index (uint32_t type)
@@ -1037,7 +1044,11 @@ addresse_decrement (struct GAS_PROPORTIONAL_Handle *s,
1037 1044
1038 1045
1039/** 1046/**
1040 * FIXME. 1047 * Compares addresses
1048 *
1049 * @param a address a
1050 * @param b address b
1051 * @return GNUNET_YES if equal, GNUNET_NO else
1041 */ 1052 */
1042static int 1053static int
1043address_eq (struct ATS_Address *a, struct ATS_Address *b) 1054address_eq (struct ATS_Address *a, struct ATS_Address *b)
@@ -1057,7 +1068,10 @@ address_eq (struct ATS_Address *a, struct ATS_Address *b)
1057 1068
1058 1069
1059/** 1070/**
1060 * FIXME. 1071 * Notify bandwidth changes to addresses
1072 *
1073 * @param s solver handle
1074 * @param net the network to propagate changes in
1061 */ 1075 */
1062static void 1076static void
1063propagate_bandwidth (struct GAS_PROPORTIONAL_Handle *s, 1077propagate_bandwidth (struct GAS_PROPORTIONAL_Handle *s,
@@ -1172,8 +1186,14 @@ distribute_bandwidth_in_network (struct GAS_PROPORTIONAL_Handle *s,
1172 1186
1173 1187
1174/** 1188/**
1175 * FIXME 1189 * Update active address for a peer:
1176 */ 1190 * Check if active address exists and what the best address is, if addresses
1191 * are different switch
1192 *
1193 * @param s solver handle
1194 * @param peer the peer to check
1195 * return the new address or NULL if no update was performed
1196 */
1177static const struct ATS_Address * 1197static const struct ATS_Address *
1178update_active_address (struct GAS_PROPORTIONAL_Handle *s, 1198update_active_address (struct GAS_PROPORTIONAL_Handle *s,
1179 const struct GNUNET_PeerIdentity *peer) 1199 const struct GNUNET_PeerIdentity *peer)
@@ -1189,9 +1209,20 @@ update_active_address (struct GAS_PROPORTIONAL_Handle *s,
1189 1209
1190 /* Find active address */ 1210 /* Find active address */
1191 current_address = get_active_address (s, s->addresses, peer); 1211 current_address = get_active_address (s, s->addresses, peer);
1212
1213 LOG (GNUNET_ERROR_TYPE_INFO,
1214 "Peer `%s' has active address %p\n",
1215 GNUNET_i2s (peer),
1216 current_address);
1217
1218
1192 /* Find best address */ 1219 /* Find best address */
1193 best_address = get_best_address (s,s->addresses, peer); 1220 best_address = get_best_address (s,s->addresses, peer);
1194 1221
1222 LOG (GNUNET_ERROR_TYPE_INFO,
1223 "Peer `%s' has best address %p\n",
1224 GNUNET_i2s (peer), best_address);
1225
1195 if (NULL != current_address) 1226 if (NULL != current_address)
1196 { 1227 {
1197 if ((NULL == best_address) || ((NULL != best_address) && 1228 if ((NULL == best_address) || ((NULL != best_address) &&
@@ -1338,7 +1369,7 @@ GAS_proportional_address_preference_feedback (void *solver,
1338 * 1369 *
1339 * @param solver the solver handle 1370 * @param solver the solver handle
1340 * @param peer the identity of the peer 1371 * @param peer the identity of the peer
1341 * @return FIXME 1372 * @return best address
1342 */ 1373 */
1343static const struct ATS_Address * 1374static const struct ATS_Address *
1344GAS_proportional_get_preferred_address (void *solver, 1375GAS_proportional_get_preferred_address (void *solver,