aboutsummaryrefslogtreecommitdiff
path: root/src/ats/gnunet-service-ats-solver_mlp.c
diff options
context:
space:
mode:
authorMatthias Wachs <wachs@net.in.tum.de>2013-09-26 15:39:45 +0000
committerMatthias Wachs <wachs@net.in.tum.de>2013-09-26 15:39:45 +0000
commit3f58f4efba8e70bd2fbe1c44c24882945bb601ef (patch)
tree84ff17cf9d068a4c1d89bd0e506ce488b25b297b /src/ats/gnunet-service-ats-solver_mlp.c
parentf1cf91943e1ebf90db1ae40a296363275c673d23 (diff)
downloadgnunet-3f58f4efba8e70bd2fbe1c44c24882945bb601ef.tar.gz
gnunet-3f58f4efba8e70bd2fbe1c44c24882945bb601ef.zip
exclude requested peer from propagation since addresses will send result
Diffstat (limited to 'src/ats/gnunet-service-ats-solver_mlp.c')
-rw-r--r--src/ats/gnunet-service-ats-solver_mlp.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/src/ats/gnunet-service-ats-solver_mlp.c b/src/ats/gnunet-service-ats-solver_mlp.c
index 0c7150092..f921c1b1f 100644
--- a/src/ats/gnunet-service-ats-solver_mlp.c
+++ b/src/ats/gnunet-service-ats-solver_mlp.c
@@ -935,7 +935,6 @@ mlp_solve_mlp_problem (struct GAS_MLP_Handle *mlp)
935 } 935 }
936} 936}
937 937
938
939/** 938/**
940 * Propagates the results when MLP problem was solved 939 * Propagates the results when MLP problem was solved
941 * 940 *
@@ -998,8 +997,8 @@ mlp_propagate_results (void *cls, const struct GNUNET_HashCode *key, void *value
998 mlpi->b_in.value__ = htonl(mlp_bw_in); 997 mlpi->b_in.value__ = htonl(mlp_bw_in);
999 address->assigned_bw_out.value__ = htonl (mlp_bw_out); 998 address->assigned_bw_out.value__ = htonl (mlp_bw_out);
1000 mlpi->b_out.value__ = htonl(mlp_bw_out); 999 mlpi->b_out.value__ = htonl(mlp_bw_out);
1001 1000 if ((NULL == mlp->exclude_peer) || (0 != memcmp (&address->peer, mlp->exclude_peer, sizeof (address->peer))))
1002 mlp->bw_changed_cb (mlp->bw_changed_cb_cls, address); 1001 mlp->bw_changed_cb (mlp->bw_changed_cb_cls, address);
1003 return GNUNET_OK; 1002 return GNUNET_OK;
1004 } 1003 }
1005 else if (GNUNET_YES == address->active) 1004 else if (GNUNET_YES == address->active)
@@ -1014,8 +1013,8 @@ mlp_propagate_results (void *cls, const struct GNUNET_HashCode *key, void *value
1014 mlpi->b_in.value__ = htonl(mlp_bw_in); 1013 mlpi->b_in.value__ = htonl(mlp_bw_in);
1015 address->assigned_bw_out.value__ = htonl (mlp_bw_out); 1014 address->assigned_bw_out.value__ = htonl (mlp_bw_out);
1016 mlpi->b_out.value__ = htonl(mlp_bw_out); 1015 mlpi->b_out.value__ = htonl(mlp_bw_out);
1017 1016 if ((NULL == mlp->exclude_peer) || (0 != memcmp (&address->peer, mlp->exclude_peer, sizeof (address->peer))))
1018 mlp->bw_changed_cb (mlp->bw_changed_cb_cls, address); 1017 mlp->bw_changed_cb (mlp->bw_changed_cb_cls, address);
1019 return GNUNET_OK; 1018 return GNUNET_OK;
1020 } 1019 }
1021 } 1020 }
@@ -1056,8 +1055,6 @@ mlp_propagate_results (void *cls, const struct GNUNET_HashCode *key, void *value
1056 return GNUNET_OK; 1055 return GNUNET_OK;
1057} 1056}
1058 1057
1059
1060
1061/** 1058/**
1062 * Solves the MLP problem 1059 * Solves the MLP problem
1063 * 1060 *
@@ -1151,7 +1148,9 @@ GAS_mlp_solve_problem (void *solver)
1151 1148
1152 /* Propagate result*/ 1149 /* Propagate result*/
1153 if ((GNUNET_OK == res_lp) && (GNUNET_OK == res_mip)) 1150 if ((GNUNET_OK == res_lp) && (GNUNET_OK == res_mip))
1151 {
1154 GNUNET_CONTAINER_multihashmap_iterate (mlp->addresses, &mlp_propagate_results, mlp); 1152 GNUNET_CONTAINER_multihashmap_iterate (mlp->addresses, &mlp_propagate_results, mlp);
1153 }
1155 1154
1156 struct GNUNET_TIME_Absolute time = GNUNET_TIME_absolute_get(); 1155 struct GNUNET_TIME_Absolute time = GNUNET_TIME_absolute_get();
1157 if (GNUNET_YES == mlp->write_mip_mps) 1156 if (GNUNET_YES == mlp->write_mip_mps)
@@ -1596,7 +1595,11 @@ GAS_mlp_get_preferred_address (void *solver,
1596 if ((GNUNET_YES == mlp->mlp_auto_solve)&& 1595 if ((GNUNET_YES == mlp->mlp_auto_solve)&&
1597 (GNUNET_YES == GNUNET_CONTAINER_multihashmap_contains(mlp->addresses, 1596 (GNUNET_YES == GNUNET_CONTAINER_multihashmap_contains(mlp->addresses,
1598 &peer->hashPubKey))) 1597 &peer->hashPubKey)))
1598 {
1599 mlp->exclude_peer = peer;
1599 GAS_mlp_solve_problem (mlp); 1600 GAS_mlp_solve_problem (mlp);
1601 mlp->exclude_peer = NULL;
1602 }
1600 } 1603 }
1601 /* Get prefered address */ 1604 /* Get prefered address */
1602 res = NULL; 1605 res = NULL;