aboutsummaryrefslogtreecommitdiff
path: root/src/ats/plugin_ats_mlp.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2015-02-08 18:13:10 +0000
committerChristian Grothoff <christian@grothoff.org>2015-02-08 18:13:10 +0000
commited8beb3bda5f3b1d2bf31f57f077bf90e40af812 (patch)
tree4ee276dfc49030a79cd7a8c5b26ab08a6aaffde2 /src/ats/plugin_ats_mlp.c
parente1669fabbcb9f21c509e03811fe2d8b5b568b15c (diff)
downloadgnunet-ed8beb3bda5f3b1d2bf31f57f077bf90e40af812.tar.gz
gnunet-ed8beb3bda5f3b1d2bf31f57f077bf90e40af812.zip
changing s_get API to return void instead of address, have plugin use existing mechanism to signal address activation
Diffstat (limited to 'src/ats/plugin_ats_mlp.c')
-rw-r--r--src/ats/plugin_ats_mlp.c24
1 files changed, 15 insertions, 9 deletions
diff --git a/src/ats/plugin_ats_mlp.c b/src/ats/plugin_ats_mlp.c
index 900a07fa5..b97261d46 100644
--- a/src/ats/plugin_ats_mlp.c
+++ b/src/ats/plugin_ats_mlp.c
@@ -2063,9 +2063,8 @@ get_peer_pref_value (struct GAS_MLP_Handle *mlp,
2063 * 2063 *
2064 * @param solver the MLP Handle 2064 * @param solver the MLP Handle
2065 * @param peer the peer 2065 * @param peer the peer
2066 * @return suggested address
2067 */ 2066 */
2068static const struct ATS_Address * 2067static void
2069GAS_mlp_get_preferred_address (void *solver, 2068GAS_mlp_get_preferred_address (void *solver,
2070 const struct GNUNET_PeerIdentity *peer) 2069 const struct GNUNET_PeerIdentity *peer)
2071{ 2070{
@@ -2073,11 +2072,9 @@ GAS_mlp_get_preferred_address (void *solver,
2073 struct ATS_Peer *p; 2072 struct ATS_Peer *p;
2074 struct ATS_Address *res; 2073 struct ATS_Address *res;
2075 2074
2076 GNUNET_assert (NULL != solver); 2075 LOG (GNUNET_ERROR_TYPE_DEBUG,
2077 GNUNET_assert (NULL != peer); 2076 "Getting preferred address for `%s'\n",
2078 2077 GNUNET_i2s (peer));
2079 LOG (GNUNET_ERROR_TYPE_DEBUG, "Getting preferred address for `%s'\n",
2080 GNUNET_i2s (peer));
2081 2078
2082 /* Is this peer included in the problem? */ 2079 /* Is this peer included in the problem? */
2083 if (NULL == 2080 if (NULL ==
@@ -2110,7 +2107,9 @@ GAS_mlp_get_preferred_address (void *solver,
2110 res = NULL; 2107 res = NULL;
2111 GNUNET_CONTAINER_multipeermap_get_multiple (mlp->env->addresses, peer, 2108 GNUNET_CONTAINER_multipeermap_get_multiple (mlp->env->addresses, peer,
2112 &mlp_get_preferred_address_it, &res); 2109 &mlp_get_preferred_address_it, &res);
2113 return res; 2110 if (NULL != res)
2111 mlp->env->bandwidth_changed_cb (mlp->env->cls,
2112 res);
2114} 2113}
2115 2114
2116 2115
@@ -2128,6 +2127,7 @@ GAS_mlp_address_delete (void *solver,
2128{ 2127{
2129 struct GAS_MLP_Handle *mlp = solver; 2128 struct GAS_MLP_Handle *mlp = solver;
2130 struct MLP_information *mlpi; 2129 struct MLP_information *mlpi;
2130 struct ATS_Address *res;
2131 int was_active; 2131 int was_active;
2132 2132
2133 mlpi = address->solver_information; 2133 mlpi = address->solver_information;
@@ -2164,7 +2164,13 @@ GAS_mlp_address_delete (void *solver,
2164 } 2164 }
2165 if (GNUNET_YES == was_active) 2165 if (GNUNET_YES == was_active)
2166 { 2166 {
2167 if (NULL == GAS_mlp_get_preferred_address (solver, &address->peer)) 2167 GAS_mlp_get_preferred_address (solver, &address->peer);
2168 res = NULL;
2169 GNUNET_CONTAINER_multipeermap_get_multiple (mlp->env->addresses,
2170 &address->peer,
2171 &mlp_get_preferred_address_it,
2172 &res);
2173 if (NULL == res)
2168 { 2174 {
2169 /* No alternative address, disconnecting peer */ 2175 /* No alternative address, disconnecting peer */
2170 mlp->env->bandwidth_changed_cb (mlp->env->cls, address); 2176 mlp->env->bandwidth_changed_cb (mlp->env->cls, address);