[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r35172 - in gnunet/src: ats include
From: |
gnunet |
Subject: |
[GNUnet-SVN] r35172 - in gnunet/src: ats include |
Date: |
Sun, 8 Feb 2015 19:13:10 +0100 |
Author: grothoff
Date: 2015-02-08 19:13:10 +0100 (Sun, 08 Feb 2015)
New Revision: 35172
Modified:
gnunet/src/ats/gnunet-ats-solver-eval.c
gnunet/src/ats/gnunet-service-ats_plugins.c
gnunet/src/ats/plugin_ats_mlp.c
gnunet/src/ats/plugin_ats_proportional.c
gnunet/src/ats/plugin_ats_ril.c
gnunet/src/include/gnunet_ats_plugin.h
Log:
changing s_get API to return void instead of address, have plugin use existing
mechanism to signal address activation
Modified: gnunet/src/ats/gnunet-ats-solver-eval.c
===================================================================
--- gnunet/src/ats/gnunet-ats-solver-eval.c 2015-02-08 17:40:57 UTC (rev
35171)
+++ gnunet/src/ats/gnunet-ats-solver-eval.c 2015-02-08 18:13:10 UTC (rev
35172)
@@ -2382,7 +2382,6 @@
enforce_start_request (struct GNUNET_ATS_TEST_Operation *op)
{
struct TestPeer *p;
- const struct ATS_Address *res;
if (NULL == (p = find_peer_by_id (op->peer_id)))
{
@@ -2396,18 +2395,10 @@
op->peer_id);
p->is_requested = GNUNET_YES;
- res = sh->sf->s_get (sh->sf->cls, &p->peer_id);
- if (NULL != res)
- {
- GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Suggested address for peer %u: %llu
%llu\n",
- op->peer_id,
- res->assigned_bw_in,
- res->assigned_bw_out);
- if (NULL != l)
- GNUNET_ATS_solver_logging_now (l);
- }
+ sh->sf->s_get (sh->sf->cls, &p->peer_id);
}
+
static void
enforce_stop_request (struct GNUNET_ATS_TEST_Operation *op)
{
@@ -2421,10 +2412,9 @@
return;
}
-
-
- GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Stop requesting address for peer %u\n",
- op->peer_id);
+ GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+ "Stop requesting address for peer %u\n",
+ op->peer_id);
p->is_requested = GNUNET_NO;
p->assigned_bw_in = 0;
p->assigned_bw_out = 0;
Modified: gnunet/src/ats/gnunet-service-ats_plugins.c
===================================================================
--- gnunet/src/ats/gnunet-service-ats_plugins.c 2015-02-08 17:40:57 UTC (rev
35171)
+++ gnunet/src/ats/gnunet-service-ats_plugins.c 2015-02-08 18:13:10 UTC (rev
35172)
@@ -246,11 +246,11 @@
(diff_in < htonl(GNUNET_CONSTANTS_DEFAULT_BW_IN_OUT.value__)) )
return;
- GNUNET_log(GNUNET_ERROR_TYPE_INFO,
- "Sending bandwidth update for peer `%s': %u/%u\n",
- GNUNET_i2s (&address->peer),
- address->assigned_bw_out,
- address->assigned_bw_out);
+ GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+ "Sending bandwidth update for peer `%s': %u/%u\n",
+ GNUNET_i2s (&address->peer),
+ address->assigned_bw_out,
+ address->assigned_bw_out);
/* *Notify scheduling clients about suggestion */
GAS_scheduling_transmit_address_suggestion (&address->peer,
@@ -555,24 +555,7 @@
void
GAS_plugin_request_connect_start (const struct GNUNET_PeerIdentity *pid)
{
- const struct ATS_Address *aa;
-
- aa = sf->s_get (sf->cls, pid);
- if (NULL == aa)
- {
- GNUNET_log (GNUNET_ERROR_TYPE_INFO,
- "Cannot suggest address for peer `%s'\n",
- GNUNET_i2s (pid));
- return;
- }
- GNUNET_log(GNUNET_ERROR_TYPE_DEBUG,
- "Suggesting address %p for peer `%s'\n",
- aa,
- GNUNET_i2s (pid));
- GAS_scheduling_transmit_address_suggestion (pid,
- aa->session_id,
- GNUNET_BANDWIDTH_value_init
(aa->assigned_bw_out),
- GNUNET_BANDWIDTH_value_init
(aa->assigned_bw_in));
+ sf->s_get (sf->cls, pid);
}
Modified: gnunet/src/ats/plugin_ats_mlp.c
===================================================================
--- gnunet/src/ats/plugin_ats_mlp.c 2015-02-08 17:40:57 UTC (rev 35171)
+++ gnunet/src/ats/plugin_ats_mlp.c 2015-02-08 18:13:10 UTC (rev 35172)
@@ -2063,9 +2063,8 @@
*
* @param solver the MLP Handle
* @param peer the peer
- * @return suggested address
*/
-static const struct ATS_Address *
+static void
GAS_mlp_get_preferred_address (void *solver,
const struct GNUNET_PeerIdentity *peer)
{
@@ -2073,12 +2072,10 @@
struct ATS_Peer *p;
struct ATS_Address *res;
- GNUNET_assert (NULL != solver);
- GNUNET_assert (NULL != peer);
+ LOG (GNUNET_ERROR_TYPE_DEBUG,
+ "Getting preferred address for `%s'\n",
+ GNUNET_i2s (peer));
- LOG (GNUNET_ERROR_TYPE_DEBUG, "Getting preferred address for `%s'\n",
- GNUNET_i2s (peer));
-
/* Is this peer included in the problem? */
if (NULL ==
GNUNET_CONTAINER_multipeermap_get (mlp->requested_peers,
@@ -2110,7 +2107,9 @@
res = NULL;
GNUNET_CONTAINER_multipeermap_get_multiple (mlp->env->addresses, peer,
&mlp_get_preferred_address_it,
&res);
- return res;
+ if (NULL != res)
+ mlp->env->bandwidth_changed_cb (mlp->env->cls,
+ res);
}
@@ -2128,6 +2127,7 @@
{
struct GAS_MLP_Handle *mlp = solver;
struct MLP_information *mlpi;
+ struct ATS_Address *res;
int was_active;
mlpi = address->solver_information;
@@ -2164,7 +2164,13 @@
}
if (GNUNET_YES == was_active)
{
- if (NULL == GAS_mlp_get_preferred_address (solver, &address->peer))
+ GAS_mlp_get_preferred_address (solver, &address->peer);
+ res = NULL;
+ GNUNET_CONTAINER_multipeermap_get_multiple (mlp->env->addresses,
+ &address->peer,
+ &mlp_get_preferred_address_it,
+ &res);
+ if (NULL == res)
{
/* No alternative address, disconnecting peer */
mlp->env->bandwidth_changed_cb (mlp->env->cls, address);
Modified: gnunet/src/ats/plugin_ats_proportional.c
===================================================================
--- gnunet/src/ats/plugin_ats_proportional.c 2015-02-08 17:40:57 UTC (rev
35171)
+++ gnunet/src/ats/plugin_ats_proportional.c 2015-02-08 18:13:10 UTC (rev
35172)
@@ -929,26 +929,15 @@
struct AddressWrapper *asi;
struct Network *net;
- LOG (GNUNET_ERROR_TYPE_INFO,
- "Updating active address for peer `%s'\n",
- GNUNET_i2s (peer));
-
- /* Find active address */
current_address = get_active_address (s,
peer);
-
- LOG (GNUNET_ERROR_TYPE_INFO,
- "Peer `%s' has active address %p\n",
- GNUNET_i2s (peer),
- current_address);
-
- /* Find best address */
best_address = get_best_address (s,
s->env->addresses,
peer);
LOG (GNUNET_ERROR_TYPE_INFO,
- "Peer `%s' has best address %p\n",
+ "Peer `%s' has active address %p and best address %p\n",
GNUNET_i2s (peer),
+ current_address,
best_address);
if (NULL != current_address)
@@ -1106,19 +1095,21 @@
*
* @param solver the solver handle
* @param peer the identity of the peer
- * @return best address
*/
-static const struct ATS_Address *
+static void
GAS_proportional_get_preferred_address (void *solver,
const struct GNUNET_PeerIdentity *peer)
{
struct GAS_PROPORTIONAL_Handle *s = solver;
- const struct ATS_Address *best_address;
+ struct ATS_Address *best_address;
best_address = update_active_address (s, peer);
+ if (NULL == best_address)
+ return;
if (s->bulk_lock > 0)
- return NULL;
- return best_address;
+ return;
+ s->env->bandwidth_changed_cb (s->env->cls,
+ best_address);
}
Modified: gnunet/src/ats/plugin_ats_ril.c
===================================================================
--- gnunet/src/ats/plugin_ats_ril.c 2015-02-08 17:40:57 UTC (rev 35171)
+++ gnunet/src/ats/plugin_ats_ril.c 2015-02-08 18:13:10 UTC (rev 35172)
@@ -2484,7 +2484,7 @@
* @param solver the solver handle
* @param peer the identity of the peer
*/
-static const struct ATS_Address *
+static void
GAS_ril_get_preferred_address (void *solver,
const struct GNUNET_PeerIdentity *peer)
{
@@ -2514,9 +2514,12 @@
s->parameters.temperature = s->parameters.temperature_init;
s->parameters.epsilon = s->parameters.epsilon_init;
}
- return agent->address_inuse;
+ if (NULL != agent->address_inuse)
+ s->env->bandwidth_changed_cb (s->env->cls,
+ agent->address_inuse);
}
+
/**
* Tell solver stop notifying ATS about changes for this peers
*
Modified: gnunet/src/include/gnunet_ats_plugin.h
===================================================================
--- gnunet/src/include/gnunet_ats_plugin.h 2015-02-08 17:40:57 UTC (rev
35171)
+++ gnunet/src/include/gnunet_ats_plugin.h 2015-02-08 18:13:10 UTC (rev
35172)
@@ -143,7 +143,7 @@
* @param solver the solver to use
* @param peer the peer
*/
-typedef const struct ATS_Address *
+typedef void
(*GAS_solver_get_preferred_address) (void *solver,
const struct GNUNET_PeerIdentity *peer);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r35172 - in gnunet/src: ats include,
gnunet <=