diff options
author | Christian Grothoff <christian@grothoff.org> | 2015-02-08 16:24:42 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2015-02-08 16:24:42 +0000 |
commit | 4f4a572297261f4bddce6e39879340d91a492ab9 (patch) | |
tree | 0aea7620b69659cebbe4b5311263f04fd12a70a6 /src/ats/plugin_ats_mlp.c | |
parent | 386b7d1a0a8b86248e503602b30614b8a3984061 (diff) | |
download | gnunet-4f4a572297261f4bddce6e39879340d91a492ab9.tar.gz gnunet-4f4a572297261f4bddce6e39879340d91a492ab9.zip |
avoid several linear scans and allocations by combining AddressWrapper and asi structs
Diffstat (limited to 'src/ats/plugin_ats_mlp.c')
-rw-r--r-- | src/ats/plugin_ats_mlp.c | 20 |
1 files changed, 6 insertions, 14 deletions
diff --git a/src/ats/plugin_ats_mlp.c b/src/ats/plugin_ats_mlp.c index f2f961f7e..900a07fa5 100644 --- a/src/ats/plugin_ats_mlp.c +++ b/src/ats/plugin_ats_mlp.c | |||
@@ -2121,22 +2121,17 @@ GAS_mlp_get_preferred_address (void *solver, | |||
2121 | * | 2121 | * |
2122 | * @param solver the MLP Handle | 2122 | * @param solver the MLP Handle |
2123 | * @param address the address to delete | 2123 | * @param address the address to delete |
2124 | * @param session_only delete only session not whole address | ||
2125 | */ | 2124 | */ |
2126 | static void | 2125 | static void |
2127 | GAS_mlp_address_delete (void *solver, | 2126 | GAS_mlp_address_delete (void *solver, |
2128 | struct ATS_Address *address, | 2127 | struct ATS_Address *address) |
2129 | int session_only) | ||
2130 | { | 2128 | { |
2131 | struct GAS_MLP_Handle *mlp = solver; | 2129 | struct GAS_MLP_Handle *mlp = solver; |
2132 | struct MLP_information *mlpi; | 2130 | struct MLP_information *mlpi; |
2133 | int was_active; | 2131 | int was_active; |
2134 | 2132 | ||
2135 | GNUNET_assert (NULL != solver); | ||
2136 | GNUNET_assert (NULL != address); | ||
2137 | |||
2138 | mlpi = address->solver_information; | 2133 | mlpi = address->solver_information; |
2139 | if ((GNUNET_NO == session_only) && (NULL != mlpi)) | 2134 | if (NULL != mlpi) |
2140 | { | 2135 | { |
2141 | /* Remove full address */ | 2136 | /* Remove full address */ |
2142 | GNUNET_free (mlpi); | 2137 | GNUNET_free (mlpi); |
@@ -2153,14 +2148,13 @@ GAS_mlp_address_delete (void *solver, | |||
2153 | &address->peer)) | 2148 | &address->peer)) |
2154 | { | 2149 | { |
2155 | LOG (GNUNET_ERROR_TYPE_INFO, | 2150 | LOG (GNUNET_ERROR_TYPE_INFO, |
2156 | "Deleting %s for peer `%s' without address request \n", | 2151 | "Deleting address for peer `%s' without address request \n", |
2157 | (session_only == GNUNET_YES) ? "session" : "address", | ||
2158 | GNUNET_i2s(&address->peer)); | 2152 | GNUNET_i2s(&address->peer)); |
2159 | return; | 2153 | return; |
2160 | } | 2154 | } |
2161 | LOG (GNUNET_ERROR_TYPE_INFO, "Deleting %s for peer `%s' with address request \n", | 2155 | LOG (GNUNET_ERROR_TYPE_INFO, |
2162 | (session_only == GNUNET_YES) ? "session" : "address", | 2156 | "Deleting address for peer `%s' with address request \n", |
2163 | GNUNET_i2s(&address->peer)); | 2157 | GNUNET_i2s (&address->peer)); |
2164 | 2158 | ||
2165 | /* Problem size changed: new address for peer with pending request */ | 2159 | /* Problem size changed: new address for peer with pending request */ |
2166 | mlp->stat_mlp_prob_changed = GNUNET_YES; | 2160 | mlp->stat_mlp_prob_changed = GNUNET_YES; |
@@ -2176,8 +2170,6 @@ GAS_mlp_address_delete (void *solver, | |||
2176 | mlp->env->bandwidth_changed_cb (mlp->env->cls, address); | 2170 | mlp->env->bandwidth_changed_cb (mlp->env->cls, address); |
2177 | } | 2171 | } |
2178 | } | 2172 | } |
2179 | |||
2180 | return; | ||
2181 | } | 2173 | } |
2182 | 2174 | ||
2183 | 2175 | ||