summaryrefslogtreecommitdiff
path: root/src/ats/plugin_ats_mlp.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2015-02-05 12:52:20 +0000
committerChristian Grothoff <christian@grothoff.org>2015-02-05 12:52:20 +0000
commitc55971f17dc99f9833af48e078c8f681be771cb7 (patch)
tree544fd671b67903506419c98d463d086a696e25a1 /src/ats/plugin_ats_mlp.c
parent15dd8e6cc1199d611d804853e134882bf13b234a (diff)
downloadgnunet-c55971f17dc99f9833af48e078c8f681be771cb7.tar.gz
gnunet-c55971f17dc99f9833af48e078c8f681be771cb7.zip
big ATS refactoring, no serious semantic changes should stem from this
Diffstat (limited to 'src/ats/plugin_ats_mlp.c')
-rw-r--r--src/ats/plugin_ats_mlp.c127
1 files changed, 0 insertions, 127 deletions
diff --git a/src/ats/plugin_ats_mlp.c b/src/ats/plugin_ats_mlp.c
index 15fa5e6bd..eeffb3454 100644
--- a/src/ats/plugin_ats_mlp.c
+++ b/src/ats/plugin_ats_mlp.c
@@ -2043,131 +2043,6 @@ GAS_mlp_address_property_changed (void *solver,
2043 2043
2044 2044
2045/** 2045/**
2046 * Transport session for this address has changed
2047 *
2048 * NOTE: values in addresses are already updated
2049 *
2050 * @param solver solver handle
2051 * @param address the address
2052 * @param cur_session the current session
2053 * @param new_session the new session
2054 */
2055static void
2056GAS_mlp_address_session_changed (void *solver,
2057 struct ATS_Address *address,
2058 uint32_t cur_session,
2059 uint32_t new_session)
2060{
2061 /* Nothing to do here */
2062 return;
2063}
2064
2065
2066/**
2067 * Network scope for this address has changed
2068 *
2069 * NOTE: values in addresses are already updated
2070 *
2071 * @param solver solver handle
2072 * @param address the address
2073 * @param current_network the current network
2074 * @param new_network the new network
2075 */
2076static void
2077GAS_mlp_address_change_network (void *solver,
2078 struct ATS_Address *address,
2079 uint32_t current_network,
2080 uint32_t new_network)
2081{
2082 struct MLP_information *mlpi = address->solver_information;
2083 struct GAS_MLP_Handle *mlp = solver;
2084 int nets_avail[] = GNUNET_ATS_NetworkType;
2085 int c1;
2086
2087 GNUNET_assert (NULL != solver);
2088 GNUNET_assert (NULL != address);
2089
2090 if (GNUNET_ATS_NetworkTypeCount <= new_network)
2091 {
2092 GNUNET_break (0);
2093 return;
2094 }
2095
2096 if (NULL == mlpi)
2097 {
2098 GNUNET_break (0);
2099 return;
2100 }
2101
2102 if (mlpi->c_b == MLP_UNDEFINED)
2103 return; /* This address is not yet in the matrix*/
2104
2105 if (NULL ==
2106 GNUNET_CONTAINER_multipeermap_get (mlp->requested_peers,
2107 &address->peer))
2108 {
2109 /* Peer is not requested, so no need to update problem */
2110 GNUNET_break (0);
2111 return;
2112 }
2113
2114 if (current_network == new_network)
2115 {
2116 GNUNET_break (0);
2117 return;
2118 }
2119
2120 for (c1 = 0; c1 < GNUNET_ATS_NetworkTypeCount ; c1 ++)
2121 {
2122 if (nets_avail[c1] == new_network)
2123 break;
2124 }
2125
2126 if (GNUNET_ATS_NetworkTypeCount == c1)
2127 {
2128 /* Invalid network */
2129 GNUNET_break (0);
2130 return;
2131 }
2132
2133 LOG (GNUNET_ERROR_TYPE_DEBUG, "Updating network for peer `%s' from `%s' to `%s'\n",
2134 GNUNET_i2s (&address->peer),
2135 GNUNET_ATS_print_network_type(current_network),
2136 GNUNET_ATS_print_network_type(new_network));
2137
2138 for (c1 = 0; c1 < GNUNET_ATS_NetworkTypeCount; c1++)
2139 {
2140 if (mlp->pv.quota_index[c1] == current_network)
2141 {
2142 /* Remove from old network */
2143 mlp_create_problem_update_value (&mlp->p,
2144 mlp->p.r_quota[c1],
2145 mlpi->c_b, 0.0, __LINE__);
2146 break;
2147 }
2148 }
2149
2150 for (c1 = 0; c1 < GNUNET_ATS_NetworkTypeCount; c1++)
2151 {
2152 if (mlp->pv.quota_index[c1] == new_network)
2153 {
2154 /* Remove from old network */
2155 if (GNUNET_SYSERR == mlp_create_problem_update_value (&mlp->p,
2156 mlp->p.r_quota[c1],
2157 mlpi->c_b, 1.0, __LINE__))
2158 {
2159 /* This quota did not exist in the problem, recreate */
2160 GNUNET_break (0);
2161 }
2162 break;
2163 }
2164 }
2165
2166 mlp->stat_mlp_prob_changed = GNUNET_YES;
2167}
2168
2169
2170/**
2171 * Find the active address in the set of addresses of a peer 2046 * Find the active address in the set of addresses of a peer
2172 * @param cls destination 2047 * @param cls destination
2173 * @param key peer id 2048 * @param key peer id
@@ -2953,8 +2828,6 @@ libgnunet_plugin_ats_mlp_init (void *cls)
2953 mlp->env = env; 2828 mlp->env = env;
2954 env->sf.s_add = &GAS_mlp_address_add; 2829 env->sf.s_add = &GAS_mlp_address_add;
2955 env->sf.s_address_update_property = &GAS_mlp_address_property_changed; 2830 env->sf.s_address_update_property = &GAS_mlp_address_property_changed;
2956 env->sf.s_address_update_session = &GAS_mlp_address_session_changed;
2957 env->sf.s_address_update_network = &GAS_mlp_address_change_network;
2958 env->sf.s_get = &GAS_mlp_get_preferred_address; 2831 env->sf.s_get = &GAS_mlp_get_preferred_address;
2959 env->sf.s_get_stop = &GAS_mlp_stop_get_preferred_address; 2832 env->sf.s_get_stop = &GAS_mlp_stop_get_preferred_address;
2960 env->sf.s_pref = &GAS_mlp_address_change_preference; 2833 env->sf.s_pref = &GAS_mlp_address_change_preference;