* @return GNUNET_OK
*/
static int
-reset_peers (void *cls,
- const struct GNUNET_PeerIdentity *key,
+reset_peers (void *cls,
+ const struct GNUNET_PeerIdentity *key,
void *value)
{
struct ATS_Peer *peer = value;
mlp->p.ci = MLP_UNDEFINED;
- GNUNET_CONTAINER_multipeermap_iterate (mlp->requested_peers,
+ GNUNET_CONTAINER_multipeermap_iterate (mlp->requested_peers,
&reset_peers, NULL);
}
};
static int
-mlp_create_problem_count_addresses_it (void *cls,
+mlp_create_problem_count_addresses_it (void *cls,
const struct GNUNET_PeerIdentity *key,
void *value)
{
}
-static int
+static int
mlp_create_problem_count_addresses (const struct GNUNET_CONTAINER_MultiPeerMap *peers,
const struct GNUNET_CONTAINER_MultiPeerMap *addresses)
{
cctx.peers = peers;
cctx.result = 0;
- GNUNET_CONTAINER_multipeermap_iterate (addresses,
+ GNUNET_CONTAINER_multipeermap_iterate (addresses,
&mlp_create_problem_count_addresses_it, &cctx);
return cctx.result;
}
* - Set address dependent entries in problem matrix as well
*/
static int
-mlp_create_problem_add_address_information (void *cls,
- const struct GNUNET_PeerIdentity *key,
+mlp_create_problem_add_address_information (void *cls,
+ const struct GNUNET_PeerIdentity *key,
void *value)
{
struct GAS_MLP_Handle *mlp = cls;
LOG (GNUNET_ERROR_TYPE_DEBUG,
"Rebuilding problem for %u peer(s) and %u addresse(s) and %u quality metrics == %u elements\n",
p->num_peers,
- p->num_addresses,
+ p->num_addresses,
mlp->pv.m_q,
p->num_elements);
mlp_create_problem_add_invariant_rows (mlp, p);
/* Adding address dependent columns constraint rows */
- GNUNET_CONTAINER_multipeermap_iterate (mlp->addresses,
- &mlp_create_problem_add_address_information,
+ GNUNET_CONTAINER_multipeermap_iterate (mlp->addresses,
+ &mlp_create_problem_add_address_information,
mlp);
/* Load the matrix */
* @return #GNUNET_OK to continue
*/
int
-mlp_propagate_results (void *cls,
- const struct GNUNET_PeerIdentity *key,
+mlp_propagate_results (void *cls,
+ const struct GNUNET_PeerIdentity *key,
void *value)
{
struct GAS_MLP_Handle *mlp = cls;
double mlp_use = MLP_NaN;
/* Check if we have to add this peer due to a pending request */
- if (GNUNET_NO == GNUNET_CONTAINER_multipeermap_contains (mlp->requested_peers,
+ if (GNUNET_NO == GNUNET_CONTAINER_multipeermap_contains (mlp->requested_peers,
key))
{
return GNUNET_OK;
address->solver_information = GNUNET_new (struct MLP_information);
}
else
- LOG (GNUNET_ERROR_TYPE_ERROR,
- _("Adding address for peer `%s' multiple times\n"),
+ LOG (GNUNET_ERROR_TYPE_ERROR,
+ _("Adding address for peer `%s' multiple times\n"),
GNUNET_i2s(&address->peer));
/* Is this peer included in the problem? */
- if (NULL == (p = GNUNET_CONTAINER_multipeermap_get (mlp->requested_peers,
+ if (NULL == (p = GNUNET_CONTAINER_multipeermap_get (mlp->requested_peers,
&address->peer)))
{
LOG (GNUNET_ERROR_TYPE_DEBUG, "Adding address for peer `%s' without address request \n", GNUNET_i2s(&address->peer));
* @return GNUNET_OK
*/
static int
-mlp_get_preferred_address_it (void *cls,
- const struct GNUNET_PeerIdentity *key,
+mlp_get_preferred_address_it (void *cls,
+ const struct GNUNET_PeerIdentity *key,
void *value)
{
static int counter = 0;
}
-static double
+static double
get_peer_pref_value (struct GAS_MLP_Handle *mlp, const struct GNUNET_PeerIdentity *peer)
{
double res;
p = GNUNET_malloc (sizeof (struct ATS_Peer));
p->id = (*peer);
p->f = get_peer_pref_value (mlp, peer);
- GNUNET_CONTAINER_multipeermap_put (mlp->requested_peers,
- peer, p,
+ GNUNET_CONTAINER_multipeermap_put (mlp->requested_peers,
+ peer, p,
GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST);
/* Added new peer, we have to rebuild problem before solving */
static int
-mlp_free_peers (void *cls,
+mlp_free_peers (void *cls,
const struct GNUNET_PeerIdentity *key, void *value)
{
struct GNUNET_CONTAINER_MultiPeerMap *map = cls;
LOG (GNUNET_ERROR_TYPE_DEBUG, "Shutting down mlp solver\n");
mlp_delete_problem (mlp);
- GNUNET_CONTAINER_multipeermap_iterate (mlp->requested_peers,
- &mlp_free_peers,
+ GNUNET_CONTAINER_multipeermap_iterate (mlp->requested_peers,
+ &mlp_free_peers,
mlp->requested_peers);
GNUNET_CONTAINER_multipeermap_destroy (mlp->requested_peers);
mlp->requested_peers = NULL;