{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Updating quality metrics for peer `%s'\n",
GNUNET_i2s (&address->peer));
-
+ GNUNET_assert (NULL != address->ats);
struct MLP_information *mlpi = address->mlp_information;
struct GNUNET_ATS_Information *ats = address->ats;
GNUNET_assert (mlpi != NULL);
int c;
-
for (c = 0; c < GNUNET_ATS_QualityPropertiesCount; c++)
{
int index = mlp_lookup_ats(address, mlp->q[c]);
GNUNET_CONTAINER_DLL_insert (peer->head, peer->tail, address);
}
-
update_quality (mlp, address);
}
else
struct GNUNET_STATISTICS_Handle * stats;
-//struct GNUNET_CONTAINER_MultiHashMap * addresses;
+struct GNUNET_CONTAINER_MultiHashMap * amap;
struct GAS_MLP_Handle *mlp;
+struct PeerContext
+{
+ struct GNUNET_PeerIdentity id;
+
+ struct Address *addr;
+};
+
+struct Address
+{
+ char *plugin;
+ size_t plugin_len;
+
+ void *addr;
+ size_t addr_len;
+
+ struct GNUNET_ATS_Information *ats;
+ int ats_count;
+
+ void *session;
+};
+
static void
check (void *cls, char *const *args, const char *cfgfile,
const struct GNUNET_CONFIGURATION_Handle *cfg)
ret = 1;
return;
#endif
+ unsigned int c = 0;
+ unsigned int c2 = 0;
+ unsigned int ca = 0;
+ //char * pid;
if (peers == 0)
peers = DEF_PEERS;
GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Setting up %u peers with %u addresses per peer\n", peers, addresses);
- GNUNET_HashCode hash;
- //memset (&hash, '\0', sizeof (GNUNET_HashCode));
- //hash.bits[0] = 1;
- //GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "peer %s\n", GNUNET_h2s_full (&hash));
+ struct PeerContext p[peers];
+ struct ATS_Address a[addresses * peers];
+
+ amap = GNUNET_CONTAINER_multihashmap_create(addresses * peers);
mlp = GAS_mlp_init (cfg, NULL, MLP_MAX_EXEC_DURATION, MLP_MAX_ITERATIONS);
mlp->auto_solve = GNUNET_NO;
-
+ for (c=0; c < peers; c++)
+ {
+ GNUNET_CRYPTO_hash_create_random(GNUNET_CRYPTO_QUALITY_WEAK, &p[c].id.hashPubKey);
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "peer %s\n", GNUNET_h2s_full(&p[c].id.hashPubKey));
+
+ for (c2=0; c2 < addresses; c2++)
+ {
+ a[ca].peer = p[c].id;
+ a[ca].plugin = strdup("test");
+ a[ca].addr = GNUNET_HELLO_address_allocate(&a[ca].peer, a[ca].plugin, NULL, 0);
+ a[ca].addr_len = GNUNET_HELLO_address_get_size(a[ca].addr);
+ a[ca].ats = NULL;
+ ca++;
+ GAS_mlp_address_update(mlp, amap, &a[c2]);
+ }
+ }
+
+ GAS_mlp_solve_problem(mlp);
GAS_mlp_done (mlp);
+ for (c2=0; c2 < (peers * addresses); c2++)
+ {
+ GNUNET_free (a[c2].plugin);
+ GNUNET_free (a[c2].addr);
+// GAS_mlp_address_update(mlp, amap, &a[c2]);
+ }
+
ret = 0;
return;
}