[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r25257 - gnunet/src/ats
From: |
gnunet |
Subject: |
[GNUnet-SVN] r25257 - gnunet/src/ats |
Date: |
Wed, 5 Dec 2012 15:41:46 +0100 |
Author: wachs
Date: 2012-12-05 15:41:46 +0100 (Wed, 05 Dec 2012)
New Revision: 25257
Modified:
gnunet/src/ats/gnunet-service-ats_addresses.c
gnunet/src/ats/gnunet-service-ats_addresses.h
gnunet/src/ats/gnunet-service-ats_addresses_simplistic.c
gnunet/src/ats/gnunet-service-ats_addresses_simplistic.h
Log:
remove unusued code
Modified: gnunet/src/ats/gnunet-service-ats_addresses.c
===================================================================
--- gnunet/src/ats/gnunet-service-ats_addresses.c 2012-12-05 14:31:39 UTC
(rev 25256)
+++ gnunet/src/ats/gnunet-service-ats_addresses.c 2012-12-05 14:41:46 UTC
(rev 25257)
@@ -165,7 +165,7 @@
static unsigned int
-assemble_ats_information (struct ATS_Address *aa, struct
GNUNET_ATS_Information **dest)
+assemble_ats_information (const struct ATS_Address *aa, struct
GNUNET_ATS_Information **dest)
{
unsigned int ats_count = GNUNET_ATS_PropertyCount - 1;
struct GNUNET_ATS_Information *ats = GNUNET_malloc (ats_count * sizeof
(struct GNUNET_ATS_Information));
@@ -190,77 +190,7 @@
return ats_count;
}
-static void
-send_bw_notification (struct ATS_Address *aa)
-{
- struct GNUNET_ATS_Information *ats;
- uint32_t ats_count;
-
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "New bandwidth for peer %s is %u/%u\n",
- GNUNET_i2s (&aa->peer), ntohl (aa->assigned_bw_in.value__),
- ntohl (aa->assigned_bw_out.value__));
- ats_count = assemble_ats_information (aa, &ats);
-
- GAS_scheduling_transmit_address_suggestion (&aa->peer, aa->plugin, aa->addr,
- aa->addr_len, aa->session_id,
- ats, ats_count,
- aa->assigned_bw_out,
- aa->assigned_bw_in);
- GAS_reservations_set_bandwidth (&aa->peer, aa->assigned_bw_in);
- GAS_performance_notify_all_clients (&aa->peer, aa->plugin, aa->addr,
aa->addr_len,
- aa->active,
- ats, ats_count, aa->assigned_bw_out,
- aa->assigned_bw_in);
- GNUNET_free (ats);
-}
-
/**
- * Update a bandwidth assignment for a peer. This trivial method currently
- * simply assigns the same share to all active connections.
- *
- * @param cls unused
- * @param key unused
- * @param value the 'struct ATS_Address'
- * @return GNUNET_OK (continue to iterate)
- */
-static int
-update_bw_simple_it (void *cls, const struct GNUNET_HashCode * key, void
*value)
-{
- struct ATS_Address *aa = value;
-
- if (GNUNET_YES != aa->active)
- return GNUNET_OK;
- GNUNET_assert (handle->active_addr_count > 0);
-
-
- /* Simple method */
- aa->assigned_bw_in.value__ = htonl (handle->wan_quota_in /
handle->active_addr_count);
- aa->assigned_bw_out.value__ = htonl (handle->wan_quota_out /
handle->active_addr_count);
-
- send_bw_notification (aa);
-
- return GNUNET_OK;
-}
-
-
-/**
- * Some (significant) input changed, recalculate bandwidth assignment
- * for all peers.
- */
-static void
-recalculate_assigned_bw ()
-{
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Recalculating bandwidth for all active connections\n");
- GNUNET_STATISTICS_update (GSA_stats, "# bandwidth recalculations performed",
- 1, GNUNET_NO);
- GNUNET_STATISTICS_set (GSA_stats, "# active addresses",
handle->active_addr_count,
- GNUNET_NO);
-
- GNUNET_CONTAINER_multihashmap_iterate (handle->addresses,
&update_bw_simple_it, NULL);
-}
-
-/**
* Free the given address
* @param addr address to destroy
*/
@@ -685,9 +615,9 @@
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Deleting address for peer `%s': `%s' %u\n",
GNUNET_i2s (&aa->peer), aa->plugin, aa->session_id);
-
+ /*FIXME
if (GNUNET_YES == destroy_address (aa))
- recalculate_assigned_bw ();
+ recalculate_assigned_bw (); */
return GNUNET_OK;
}
/* session != 0, just remove session */
@@ -705,7 +635,7 @@
{
aa->active = GNUNET_NO;
handle->active_addr_count--;
- recalculate_assigned_bw ();
+ //FIXME recalculate_assigned_bw ();
}
/* session == 0 and addrlen == 0 : destroy address */
@@ -807,50 +737,6 @@
}
-static void
-request_address_mlp (const struct GNUNET_PeerIdentity *peer)
-{
- struct ATS_Address *aa;
- aa = NULL;
-
-#if HAVE_GLPK
- /* Get preferred address from MODE_MLP */
- struct ATS_PreferedAddress * paddr = NULL;
- paddr = GAS_mlp_get_preferred_address (mlp, addresses, peer);
- aa = paddr->address;
- aa->assigned_bw_out = GNUNET_BANDWIDTH_value_init(paddr->bandwidth_out);
- /* FIXME use bw in value */
- paddr->bandwidth_in = paddr->bandwidth_out;
- aa->assigned_bw_in = GNUNET_BANDWIDTH_value_init (paddr->bandwidth_in);
- GNUNET_free (paddr);
-#endif
-
- if (aa == NULL)
- {
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG | GNUNET_ERROR_TYPE_BULK,
- "Cannot suggest address for peer `%s'\n", GNUNET_i2s (peer));
- return;
- }
- if (aa->active == GNUNET_NO)
- {
- aa->active = GNUNET_YES;
- handle->active_addr_count++;
- send_bw_notification (aa);
- }
- else
- {
- /* just to be sure... */
- GAS_scheduling_transmit_address_suggestion (peer, aa->plugin, aa->addr,
- aa->addr_len, aa->session_id,
- aa->ats, aa->ats_count,
- aa->assigned_bw_out,
- aa->assigned_bw_in);
- }
-
-}
-
-
-
/**
* Cancel address suggestions for a peer
*
@@ -886,7 +772,7 @@
GAS_addresses_request_address (const struct GNUNET_PeerIdentity *peer)
{
struct GAS_Addresses_Suggestion_Requests *cur = handle->r_head;
- struct ATS_Address *aa;
+ const struct ATS_Address *aa;
struct GNUNET_ATS_Information *ats;
unsigned int ats_count;
@@ -905,6 +791,7 @@
GNUNET_CONTAINER_DLL_insert (handle->r_head, handle->r_tail, cur);
}
+ /* Get prefered address from solver */
aa = handle->s_get (handle->solver, handle->addresses, peer);
if (NULL == aa)
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
Modified: gnunet/src/ats/gnunet-service-ats_addresses.h
===================================================================
--- gnunet/src/ats/gnunet-service-ats_addresses.h 2012-12-05 14:31:39 UTC
(rev 25256)
+++ gnunet/src/ats/gnunet-service-ats_addresses.h 2012-12-05 14:41:46 UTC
(rev 25257)
@@ -172,7 +172,7 @@
struct ATS_Address *address);
-typedef struct ATS_Address *
+typedef const struct ATS_Address *
(*GAS_solver_get_preferred_address) (void *solver,
struct GNUNET_CONTAINER_MultiHashMap
*addresses,
const struct GNUNET_PeerIdentity *peer);
Modified: gnunet/src/ats/gnunet-service-ats_addresses_simplistic.c
===================================================================
--- gnunet/src/ats/gnunet-service-ats_addresses_simplistic.c 2012-12-05
14:31:39 UTC (rev 25256)
+++ gnunet/src/ats/gnunet-service-ats_addresses_simplistic.c 2012-12-05
14:41:46 UTC (rev 25257)
@@ -246,7 +246,7 @@
* @param addresses the address hashmap containing all addresses
* @param peer the identity of the peer
*/
-struct ATS_Address *
+const struct ATS_Address *
GAS_simplistic_get_preferred_address (void *solver,
struct GNUNET_CONTAINER_MultiHashMap *
addresses,
const struct GNUNET_PeerIdentity *peer)
Modified: gnunet/src/ats/gnunet-service-ats_addresses_simplistic.h
===================================================================
--- gnunet/src/ats/gnunet-service-ats_addresses_simplistic.h 2012-12-05
14:31:39 UTC (rev 25256)
+++ gnunet/src/ats/gnunet-service-ats_addresses_simplistic.h 2012-12-05
14:41:46 UTC (rev 25257)
@@ -80,7 +80,7 @@
* @param addresses the address hashmap containing all addresses
* @param peer the identity of the peer
*/
-struct ATS_Address *
+const struct ATS_Address *
GAS_simplistic_get_preferred_address (void *solver,
struct GNUNET_CONTAINER_MultiHashMap *
addresses,
const struct GNUNET_PeerIdentity *peer);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r25257 - gnunet/src/ats,
gnunet <=