enum ATS_Mode
{
- SIMPLE,
- MLP
+ /**
+ * Assign each peer an equal amount of bandwidth (bw)
+ *
+ * bw_per_peer = bw_total / #active addresses
+ */
+ SIMPLE,
+
+ /**
+ * Use MLP solver to assign bandwidth
+ */
+ MLP
};
static struct GNUNET_CONTAINER_MultiHashMap *addresses;
static int ats_mode;
+
/**
* Update a bandwidth assignment for a peer. This trivial method currently
* simply assigns the same share to all active connections.
{
struct ATS_Address *aa = value;
+
+ /* Simple method */
if (GNUNET_YES != aa->active)
return GNUNET_OK;
GNUNET_assert (active_addr_count > 0);
GNUNET_CONTAINER_multihashmap_remove (addresses,
&addr->peer.hashPubKey,
addr));
+
+#if HAVE_LIBGLPK
+ if (ats_mode == MLP)
+ GAS_mlp_address_delete (addresses, addr);
+#endif
+
if (GNUNET_YES == addr->active)
{
active_addr_count--;
/* session == 0 and addrlen == 0 : destroy address */
if (aa->addr_len == 0)
+ {
(void) destroy_address (aa);
+ }
+ else
+ {
+ /* session was set to 0, update address */
+#if HAVE_LIBGLPK
+ if (ats_mode == MLP)
+ GAS_mlp_address_update (addresses, aa);
+#endif
+ }
return GNUNET_OK;
}
-
void
GAS_addresses_destroy (const struct GNUNET_PeerIdentity *peer,
const char *plugin_name, const void *plugin_addr,