[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r33673 - in gnunet/src: ats ats-tests ats-tool dv fs includ
From: |
gnunet |
Subject: |
[GNUnet-SVN] r33673 - in gnunet/src: ats ats-tests ats-tool dv fs include testbed |
Date: |
Mon, 16 Jun 2014 12:10:59 +0200 |
Author: grothoff
Date: 2014-06-16 12:10:59 +0200 (Mon, 16 Jun 2014)
New Revision: 33673
Modified:
gnunet/src/ats-tests/ats-testing.c
gnunet/src/ats-tests/gnunet-solver-eval.c
gnunet/src/ats-tool/gnunet-ats.c
gnunet/src/ats/ats_api_performance.c
gnunet/src/ats/gnunet-service-ats_addresses.c
gnunet/src/ats/gnunet-service-ats_performance.c
gnunet/src/ats/gnunet-service-ats_performance.h
gnunet/src/ats/test_ats_api_performance_list_all_addresses.c
gnunet/src/ats/test_ats_solver_add_address.c
gnunet/src/ats/test_ats_solver_alternative_after_delete_address.c
gnunet/src/dv/gnunet-service-dv.c
gnunet/src/fs/gnunet-service-fs.c
gnunet/src/include/gnunet_ats_service.h
gnunet/src/testbed/gnunet-daemon-latency-logger.c
Log:
notify performance monitors about destroyed addresses (for #3406)
Modified: gnunet/src/ats/ats_api_performance.c
===================================================================
--- gnunet/src/ats/ats_api_performance.c 2014-06-16 09:34:22 UTC (rev
33672)
+++ gnunet/src/ats/ats_api_performance.c 2014-06-16 10:10:59 UTC (rev
33673)
@@ -367,7 +367,7 @@
ats_count = ntohl (pi->ats_count);
plugin_address_length = ntohs (pi->address_length);
plugin_name_length = ntohs (pi->plugin_name_length);
- addr_active = ntohl (pi->address_active);
+ addr_active = (int) ntohl (pi->address_active);
atsi = (const struct GNUNET_ATS_Information *) &pi[1];
plugin_address = (const char *) &atsi[ats_count];
plugin_name = &plugin_address[plugin_address_length];
@@ -389,7 +389,6 @@
address.address = plugin_address;
address.address_length = plugin_address_length;
address.transport_name = plugin_name;
-
ph->addr_info_cb (ph->addr_info_cb_cls,
&address,
addr_active,
@@ -482,8 +481,9 @@
GNUNET_break(0);
return GNUNET_SYSERR;
}
- GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, _("Received %s message\n"),
- "ATS_ADDRESSLIST_RESPONSE");
+ GNUNET_log(GNUNET_ERROR_TYPE_DEBUG,
+ _("Received %s message\n"),
+ "ATS_ADDRESSLIST_RESPONSE");
pi = (const struct PeerInformationMessage *) msg;
id = ntohl (pi->id);
@@ -560,7 +560,8 @@
* @param msg message received, NULL on timeout or fatal error
*/
static void
-process_ats_message (void *cls, const struct GNUNET_MessageHeader *msg)
+process_ats_message (void *cls,
+ const struct GNUNET_MessageHeader *msg)
{
struct GNUNET_ATS_PerformanceHandle *ph = cls;
@@ -649,7 +650,7 @@
* @param cfg configuration to use
* @param addr_info_cb callback called when performance characteristics for
* an address change
- * @param addr_info_cb_cls closure for infocb
+ * @param addr_info_cb_cls closure for @a addr_info_cb
* @return ats performance context
*/
struct GNUNET_ATS_PerformanceHandle *
@@ -778,7 +779,7 @@
*
* @param handle the performance handle to use
* @param peer peer idm can be NULL for all peers
- * @param all GNUNET_YES to get information about all addresses or GNUNET_NO to
+ * @param all #GNUNET_YES to get information about all addresses or #GNUNET_NO
to
* get only address currently used
* @param infocb callback to call with the addresses,
* will callback with address == NULL when done
@@ -832,8 +833,9 @@
{
memset (&m->peer, '\0', sizeof(struct GNUNET_PeerIdentity));
}
- GNUNET_CONTAINER_DLL_insert_tail(handle->pending_head, handle->pending_tail,
- p);
+ GNUNET_CONTAINER_DLL_insert_tail(handle->pending_head,
+ handle->pending_tail,
+ p);
do_transmit (handle);
@@ -849,11 +851,11 @@
void
GNUNET_ATS_performance_list_addresses_cancel (struct
GNUNET_ATS_AddressListHandle *handle)
{
- GNUNET_assert(NULL != handle);
-
- GNUNET_CONTAINER_DLL_remove(handle->ph->addresslist_head,
- handle->ph->addresslist_tail, handle);
- GNUNET_free(handle);
+ GNUNET_assert (NULL != handle);
+ GNUNET_CONTAINER_DLL_remove (handle->ph->addresslist_head,
+ handle->ph->addresslist_tail,
+ handle);
+ GNUNET_free (handle);
}
Modified: gnunet/src/ats/gnunet-service-ats_addresses.c
===================================================================
--- gnunet/src/ats/gnunet-service-ats_addresses.c 2014-06-16 09:34:22 UTC
(rev 33672)
+++ gnunet/src/ats/gnunet-service-ats_addresses.c 2014-06-16 10:10:59 UTC
(rev 33673)
@@ -336,30 +336,37 @@
char *plugin;
};
+
/**
+ * Value we pass for zero bandwidth.
+ */
+const static struct GNUNET_BANDWIDTH_Value32NBO zero_bw;
+
+
+/**
* Disassemble ATS information and update performance information in address
*
* Updates existing information and adds new information
*
* @param dest destination address
* @param update source ATS information
- * @param update_count number of ATS information
+ * @param update_count number of ATS information in @a update
* @param delta_dest ats performance information which were updated
* including previous value
- * @param delta_count number of ATS information in the delta
- * @return GNUNET_YES if address was address updated, GNUNET_NO otherwise
+ * @param delta_count number of ATS information in the @a delta_dest
+ * @return #GNUNET_YES if address was address updated, GNUNET_NO otherwise
*/
static unsigned int
disassemble_ats_information (struct ATS_Address *dest,
- const struct GNUNET_ATS_Information *update, uint32_t update_count,
- struct GNUNET_ATS_Information **delta_dest, uint32_t *delta_count)
+ const struct GNUNET_ATS_Information *update,
+ uint32_t update_count,
+ struct GNUNET_ATS_Information **delta_dest,
+ uint32_t *delta_count)
{
-
int c1;
int c2;
int found;
int change;
-
struct GNUNET_ATS_Information add_atsi[update_count];
struct GNUNET_ATS_Information delta_atsi[update_count];
struct GNUNET_ATS_Information *tmp_atsi;
@@ -452,6 +459,7 @@
return change;
}
+
/**
* Free the given address
*
@@ -504,10 +512,13 @@
for (c2 = 0; c2 < GAS_normalization_queue_length; c2++)
aa->atsin[c1].atsi_abs[c2] = GNUNET_ATS_VALUE_UNDEFINED;
}
-
return aa;
}
+
+/**
+ * Closure for #compare_address_it()
+ */
struct CompareAddressContext
{
const struct ATS_Address *search;
@@ -599,6 +610,7 @@
return GNUNET_NO; /* Stop iteration since we have an exact address */
}
+
/**
* Find an existing equivalent address record.
* Compares by peer identity and network address OR by session ID
@@ -611,7 +623,8 @@
*/
struct ATS_Address *
find_equivalent_address (struct GAS_Addresses_Handle *handle,
- const struct GNUNET_PeerIdentity *peer, const struct ATS_Address *addr)
+ const struct GNUNET_PeerIdentity *peer,
+ const struct ATS_Address *addr)
{
struct CompareAddressContext cac;
@@ -643,29 +656,34 @@
static struct ATS_Address *
find_exact_address (struct GAS_Addresses_Handle *handle,
- const struct GNUNET_PeerIdentity *peer,
- const char *plugin_name,
- const void *plugin_addr,
- size_t plugin_addr_len,
- uint32_t local_address_info,
- uint32_t session_id)
+ const struct GNUNET_PeerIdentity *peer,
+ const char *plugin_name,
+ const void *plugin_addr,
+ size_t plugin_addr_len,
+ uint32_t local_address_info,
+ uint32_t session_id)
{
struct ATS_Address *aa;
struct ATS_Address *ea;
- aa = create_address (peer, plugin_name, plugin_addr, plugin_addr_len,
- local_address_info, session_id);
+ aa = create_address (peer,
+ plugin_name,
+ plugin_addr,
+ plugin_addr_len,
+ local_address_info,
+ session_id);
/* Get existing address or address with session == 0 */
ea = find_equivalent_address (handle, peer, aa);
free_address (aa);
- if (ea == NULL )
- return NULL ;
+ if (ea == NULL)
+ return NULL;
else if (ea->session_id != session_id)
- return NULL ;
+ return NULL;
return ea;
}
+
/**
* Function allowing the solver to obtain normalized preference
* values from solver
@@ -675,11 +693,13 @@
* @return array of double values with |GNUNET_ATS_PreferenceCount| elements
*/
const double *
-get_preferences_cb (void *cls, const struct GNUNET_PeerIdentity *id)
+get_preferences_cb (void *cls,
+ const struct GNUNET_PeerIdentity *id)
{
return GAS_normalization_get_preferences_by_peer (id);
}
+
/**
* Function allowing the solver to obtain normalized property
* values for an address from solver
@@ -694,6 +714,7 @@
return GAS_normalization_get_properties ((struct ATS_Address *) address);
}
+
/**
* Extract an ATS performance info from an address
*
@@ -718,6 +739,7 @@
return GNUNET_ATS_VALUE_UNDEFINED;
}
+
/**
* Add a new address for a peer.
*
@@ -725,22 +747,22 @@
* @param peer peer
* @param plugin_name transport plugin name
* @param plugin_addr plugin address
- * @param plugin_addr_len length of the plugin address
+ * @param plugin_addr_len length of the plugin address in @a plugin_addr
* @param local_address_info the local address for the address
* @param session_id session id, can be 0
* @param atsi performance information for this address
- * @param atsi_count number of performance information contained
+ * @param atsi_count number of performance information contained in @a atsi
*/
void
GAS_addresses_add (struct GAS_Addresses_Handle *handle,
- const struct GNUNET_PeerIdentity *peer,
- const char *plugin_name,
- const void *plugin_addr,
- size_t plugin_addr_len,
- uint32_t local_address_info,
- uint32_t session_id,
- const struct GNUNET_ATS_Information *atsi,
- uint32_t atsi_count)
+ const struct GNUNET_PeerIdentity *peer,
+ const char *plugin_name,
+ const void *plugin_addr,
+ size_t plugin_addr_len,
+ uint32_t local_address_info,
+ uint32_t session_id,
+ const struct GNUNET_ATS_Information *atsi,
+ uint32_t atsi_count)
{
struct ATS_Address *new_address;
struct ATS_Address *existing_address;
@@ -750,16 +772,19 @@
uint32_t previous_session;
int c1;
- GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "Received `%s' for peer `%s'\n",
- "ADDRESS ADD", GNUNET_i2s (peer));
+ GNUNET_log(GNUNET_ERROR_TYPE_DEBUG,
+ "Received `%s' for peer `%s'\n",
+ "ADDRESS ADD",
+ GNUNET_i2s (peer));
if (GNUNET_NO == handle->running)
return;
GNUNET_assert(NULL != handle->addresses);
- new_address = create_address (peer, plugin_name, plugin_addr,
plugin_addr_len,
- local_address_info, session_id);
+ new_address = create_address (peer, plugin_name,
+ plugin_addr, plugin_addr_len,
+ local_address_info, session_id);
atsi_delta = NULL;
disassemble_ats_information (new_address, atsi, atsi_count, &atsi_delta,
&atsi_delta_count);
@@ -775,11 +800,11 @@
/* Add a new address */
new_address->t_added = GNUNET_TIME_absolute_get();
new_address->t_last_activity = GNUNET_TIME_absolute_get();
- GNUNET_assert(
- GNUNET_OK == GNUNET_CONTAINER_multipeermap_put (handle->addresses,
- peer,
- new_address,
-
GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE));
+ GNUNET_assert(GNUNET_OK ==
+ GNUNET_CONTAINER_multipeermap_put (handle->addresses,
+ peer,
+ new_address,
+
GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE));
GNUNET_STATISTICS_set (handle->stat,
"# addresses",
@@ -899,6 +924,7 @@
session_id, GNUNET_ATS_print_network_type (addr_net));
}
+
/**
* Update an address with a session or performance information for a peer.
*
@@ -913,7 +939,7 @@
* @param local_address_info the local address for the address
* @param session_id session id, can be 0
* @param atsi performance information for this address
- * @param atsi_count number of performance information contained
+ * @param atsi_count number of performance information contained in @a atsi
*/
void
GAS_addresses_update (struct GAS_Addresses_Handle *handle,
@@ -1049,10 +1075,11 @@
const struct ATS_Address *des = dc->aa;
struct ATS_Address *aa = value;
- GNUNET_assert(
- 0 == memcmp (&aa->peer, &des->peer, sizeof(struct GNUNET_PeerIdentity)));
-
- if (des->session_id == 0)
+ GNUNET_assert(0 ==
+ memcmp (&aa->peer,
+ &des->peer,
+ sizeof (struct GNUNET_PeerIdentity)));
+ if (0 == des->session_id)
{
/* Session == 0, remove full address */
if ((0 == strcmp (des->plugin, aa->plugin))
@@ -1065,13 +1092,20 @@
GNUNET_i2s (&aa->peer),
aa->session_id,
aa);
-
/* Notify solver about deletion */
GNUNET_assert (GNUNET_YES ==
GNUNET_CONTAINER_multipeermap_remove (handle->addresses,
&aa->peer,
aa));
handle->env.sf.s_del (handle->solver, aa, GNUNET_NO);
+ GAS_performance_notify_all_clients (&aa->peer,
+ aa->plugin,
+ aa->addr,
+ aa->addr_len,
+ GNUNET_SYSERR,
+ NULL, 0,
+ zero_bw,
+ zero_bw);
free_address (aa);
dc->result = GNUNET_NO;
return GNUNET_OK; /* Continue iteration */
@@ -1107,6 +1141,14 @@
GNUNET_CONTAINER_multipeermap_remove (handle->addresses,
&aa->peer, aa));
handle->env.sf.s_del (handle->solver, aa, GNUNET_NO);
+ GAS_performance_notify_all_clients (&aa->peer,
+ aa->plugin,
+ aa->addr,
+ aa->addr_len,
+ GNUNET_SYSERR,
+ NULL, 0,
+ zero_bw,
+ zero_bw);
free_address (aa);
dc->result = GNUNET_NO;
return GNUNET_OK; /* Continue iteration */
@@ -1114,14 +1156,22 @@
else
{
/* Session died */
- GNUNET_log(GNUNET_ERROR_TYPE_INFO,
- "Deleting session for peer `%s': `%s' %u\n",
- GNUNET_i2s (&aa->peer),
- aa->plugin, aa->session_id);
+ GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+ "Deleting session for peer `%s': `%s' %u\n",
+ GNUNET_i2s (&aa->peer),
+ aa->plugin, aa->session_id);
/* Notify solver to delete session */
handle->env.sf.s_del (handle->solver, aa, GNUNET_YES);
aa->session_id = 0;
aa->active = GNUNET_NO;
+ GAS_performance_notify_all_clients (&aa->peer,
+ aa->plugin,
+ aa->addr,
+ aa->addr_len,
+ GNUNET_NO,
+ NULL, 0,
+ zero_bw,
+ zero_bw);
return GNUNET_OK;
}
}
@@ -1136,7 +1186,7 @@
* @param peer peer
* @param plugin_name transport plugin name
* @param plugin_addr plugin address
- * @param plugin_addr_len length of the plugin address
+ * @param plugin_addr_len length of the plugin address in @a plugin_addr
* @param local_address_info the local address for the address
* @param session_id session id, can be 0
*/
@@ -1156,11 +1206,16 @@
return;
/* Get existing address */
- ea = find_exact_address (handle, peer, plugin_name, plugin_addr,
- plugin_addr_len, local_address_info, session_id);
- if (ea == NULL )
+ ea = find_exact_address (handle,
+ peer,
+ plugin_name,
+ plugin_addr,
+ plugin_addr_len,
+ local_address_info,
+ session_id);
+ if (NULL == ea)
{
- GNUNET_log(GNUNET_ERROR_TYPE_DEBUG,
+ GNUNET_log(GNUNET_ERROR_TYPE_INFO,
"Tried to destroy unknown address for peer `%s' `%s' session id
%u\n",
GNUNET_i2s (peer),
plugin_name,
@@ -1168,13 +1223,12 @@
return;
}
- GNUNET_log(GNUNET_ERROR_TYPE_DEBUG,
- "Received `%s' for peer `%s' address %p session %u\n", "ADDRESS
DESTROY",
- GNUNET_i2s (peer),
- ea,
- session_id);
-
- GNUNET_break(0 < strlen (plugin_name));
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Received `%s' for peer `%s' address %p session %u\n", "ADDRESS
DESTROY",
+ GNUNET_i2s (peer),
+ ea,
+ session_id);
+ GNUNET_break (0 < strlen (plugin_name));
dc.handle = handle;
dc.aa = create_address (peer,
plugin_name,
@@ -2037,8 +2091,15 @@
/* Notify */
handle->env.sf.s_del (handle->solver, aa, GNUNET_NO);
/* Destroy */
+ GAS_performance_notify_all_clients (&aa->peer,
+ aa->plugin,
+ aa->addr,
+ aa->addr_len,
+ GNUNET_NO,
+ NULL, 0,
+ zero_bw,
+ zero_bw);
free_address (aa);
-
return GNUNET_OK;
}
@@ -2054,9 +2115,10 @@
if (GNUNET_NO == handle->running)
return;
- GNUNET_log(GNUNET_ERROR_TYPE_INFO, "Destroying all addresses\n");
+ GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+ "Destroying all addresses\n");
handle->env.sf.s_bulk_start (handle->solver);
- if (handle->addresses != NULL )
+ if (NULL != handle->addresses)
GNUNET_CONTAINER_multipeermap_iterate (handle->addresses,
&destroy_all_address_it,
handle);
@@ -2219,24 +2281,25 @@
void *pi_it_cls)
{
struct PeerInfoIteratorContext pi_ctx;
- struct GNUNET_BANDWIDTH_Value32NBO zero_bw;
GNUNET_assert(NULL != peer);
GNUNET_assert(NULL != handle->addresses);
if (NULL == pi_it)
return; /* does not make sense without callback */
- zero_bw = GNUNET_BANDWIDTH_value_init (0);
pi_ctx.it = pi_it;
pi_ctx.it_cls = pi_it_cls;
-
GNUNET_CONTAINER_multipeermap_get_multiple (handle->addresses,
peer,
&peerinfo_it, &pi_ctx);
if (NULL != pi_it)
- pi_it (pi_it_cls, NULL, NULL, NULL, 0, GNUNET_NO, NULL, 0, zero_bw,
- zero_bw);
+ pi_it (pi_it_cls,
+ NULL, NULL, NULL, 0,
+ GNUNET_NO,
+ NULL, 0,
+ zero_bw,
+ zero_bw);
}
Modified: gnunet/src/ats/gnunet-service-ats_performance.c
===================================================================
--- gnunet/src/ats/gnunet-service-ats_performance.c 2014-06-16 09:34:22 UTC
(rev 33672)
+++ gnunet/src/ats/gnunet-service-ats_performance.c 2014-06-16 10:10:59 UTC
(rev 33673)
@@ -144,9 +144,12 @@
* @param plugin_name 0-termintated string specifying the transport plugin
* @param plugin_addr binary address for the plugin to use
* @param plugin_addr_len number of bytes in plugin_addr
- * @param active is this address active
+ * @param active #GNUNET_YES if this address is actively used
+ * to maintain a connection to a peer;
+ * #GNUNET_NO if the address is not actively used;
+ * #GNUNET_SYSERR if this address is no longer available for ATS
* @param atsi performance data for the address
- * @param atsi_count number of performance records in 'ats'
+ * @param atsi_count number of performance records in @a atsi
* @param bandwidth_out assigned outbound bandwidth
* @param bandwidth_in assigned inbound bandwidth
*/
@@ -189,7 +192,7 @@
msg->ats_count = htonl (atsi_count);
msg->peer = *peer;
msg->address_length = htons (plugin_addr_len);
- msg->address_active = ntohl (active);
+ msg->address_active = ntohl ((uint32_t) active);
msg->plugin_name_length = htons (plugin_name_length);
msg->bandwidth_out = bandwidth_out;
msg->bandwidth_in = bandwidth_in;
@@ -213,7 +216,10 @@
* @param plugin_name 0-termintated string specifying the transport plugin
* @param plugin_addr binary address for the plugin to use
* @param plugin_addr_len number of bytes in @a plugin_addr
- * @param active is this address active
+ * @param active #GNUNET_YES if this address is actively used
+ * to maintain a connection to a peer;
+ * #GNUNET_NO if the address is not actively used;
+ * #GNUNET_SYSERR if this address is no longer available for ATS
* @param atsi performance data for the address
* @param atsi_count number of performance records in @a atsi
* @param bandwidth_out assigned outbound bandwidth
@@ -259,7 +265,7 @@
* @param plugin_name plugin name
* @param plugin_addr address
* @param plugin_addr_len length of @a plugin_addr
- * @param address_active is address actively used
+ * @param active is address actively used
* @param atsi ats performance information
* @param atsi_count number of ats performance elements in @a atsi
* @param bandwidth_out current outbound bandwidth assigned to address
@@ -269,8 +275,9 @@
peerinfo_it (void *cls,
const struct GNUNET_PeerIdentity *id,
const char *plugin_name,
- const void *plugin_addr, size_t plugin_addr_len,
- const int active,
+ const void *plugin_addr,
+ size_t plugin_addr_len,
+ int active,
const struct GNUNET_ATS_Information *atsi,
uint32_t atsi_count,
struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out,
@@ -360,7 +367,7 @@
const struct GNUNET_PeerIdentity *id,
const char *plugin_name,
const void *plugin_addr, size_t plugin_addr_len,
- const int active,
+ int active,
const struct GNUNET_ATS_Information *atsi,
uint32_t atsi_count,
struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out,
@@ -428,15 +435,14 @@
*/
static void
req_addr_peerinfo_it (void *cls,
- const struct GNUNET_PeerIdentity *id,
- const char *plugin_name,
- const void *plugin_addr, size_t plugin_addr_len,
- const int active,
- const struct GNUNET_ATS_Information *atsi,
- uint32_t atsi_count,
- struct GNUNET_BANDWIDTH_Value32NBO
- bandwidth_out,
- struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in)
+ const struct GNUNET_PeerIdentity *id,
+ const char *plugin_name,
+ const void *plugin_addr, size_t plugin_addr_len,
+ int active,
+ const struct GNUNET_ATS_Information *atsi,
+ uint32_t atsi_count,
+ struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out,
+ struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in)
{
struct AddressIteration *ai = cls;
@@ -515,7 +521,8 @@
* @param message the request message
*/
void
-GAS_handle_request_address_list (void *cls, struct GNUNET_SERVER_Client
*client,
+GAS_handle_request_address_list (void *cls,
+ struct GNUNET_SERVER_Client *client,
const struct GNUNET_MessageHeader *message)
{
struct PerformanceClient *pc;
@@ -568,15 +575,21 @@
GAS_handle_performance_update (struct GNUNET_PeerIdentity *peer,
const char *plugin_name,
const void *plugin_addr, size_t plugin_addr_len,
- const int active,
+ int active,
struct GNUNET_ATS_Information *ats,
uint32_t ats_count,
struct GNUNET_BANDWIDTH_Value32NBO
bandwidth_out,
struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in)
{
/* Notify here */
- GAS_performance_notify_all_clients (peer, plugin_name, plugin_addr,
- plugin_addr_len, active, ats, ats_count, bandwidth_out, bandwidth_in);
+ GAS_performance_notify_all_clients (peer,
+ plugin_name,
+ plugin_addr,
+ plugin_addr_len,
+ active,
+ ats, ats_count,
+ bandwidth_out,
+ bandwidth_in);
#if 0
struct PerformanceClient *cur;
@@ -617,7 +630,8 @@
* @param message the request message
*/
void
-GAS_handle_reservation_request (void *cls, struct GNUNET_SERVER_Client *client,
+GAS_handle_reservation_request (void *cls,
+ struct GNUNET_SERVER_Client *client,
const struct GNUNET_MessageHeader *message)
{
const struct ReservationRequestMessage *msg =
Modified: gnunet/src/ats/gnunet-service-ats_performance.h
===================================================================
--- gnunet/src/ats/gnunet-service-ats_performance.h 2014-06-16 09:34:22 UTC
(rev 33672)
+++ gnunet/src/ats/gnunet-service-ats_performance.h 2014-06-16 10:10:59 UTC
(rev 33673)
@@ -60,7 +60,7 @@
const char *plugin_name,
const void *plugin_addr,
size_t plugin_addr_len,
- const int active,
+ int active,
struct GNUNET_ATS_Information *ats,
uint32_t ats_count,
struct GNUNET_BANDWIDTH_Value32NBO
bandwidth_out,
@@ -75,8 +75,11 @@
* @param peer peer for which this is an address suggestion
* @param plugin_name 0-termintated string specifying the transport plugin
* @param plugin_addr binary address for the plugin to use
- * @param plugin_addr_len number of bytes in plugin_addr
- * @param active is this address active
+ * @param plugin_addr_len number of bytes in @a plugin_addr
+ * @param active #GNUNET_YES if this address is actively used
+ * to maintain a connection to a peer;
+ * #GNUNET_NO if the address is not actively used;
+ * #GNUNET_SYSERR if this address is no longer available for ATS
* @param atsi performance data for the address
* @param atsi_count number of performance records in @a atsi
* @param bandwidth_out assigned outbound bandwidth
@@ -87,7 +90,7 @@
const char *plugin_name,
const void *plugin_addr,
size_t plugin_addr_len,
- const int active,
+ int active,
const struct GNUNET_ATS_Information *atsi,
uint32_t atsi_count,
struct GNUNET_BANDWIDTH_Value32NBO
bandwidth_out,
@@ -141,14 +144,14 @@
*/
void
GAS_handle_preference_feedback (void *cls,
- struct GNUNET_SERVER_Client *client,
- const struct GNUNET_MessageHeader *message);
+ struct GNUNET_SERVER_Client *client,
+ const struct GNUNET_MessageHeader *message);
void
GAS_handle_monitor (void *cls,
-
struct GNUNET_SERVER_Client *client,
- const struct GNUNET_MessageHeader *message);
+ struct GNUNET_SERVER_Client *client,
+ const struct GNUNET_MessageHeader *message);
/**
* Initialize performance subsystem.
Modified: gnunet/src/ats/test_ats_api_performance_list_all_addresses.c
===================================================================
--- gnunet/src/ats/test_ats_api_performance_list_all_addresses.c
2014-06-16 09:34:22 UTC (rev 33672)
+++ gnunet/src/ats/test_ats_api_performance_list_all_addresses.c
2014-06-16 10:10:59 UTC (rev 33673)
@@ -103,6 +103,7 @@
uint32_t ats_count)
{
static int counter = 0;
+
if (NULL == address)
{
phal = 0;
@@ -140,7 +141,7 @@
"Failed to connect to performance API\n");
GNUNET_SCHEDULER_add_now (end_badly, NULL);
}
- phal = GNUNET_ATS_performance_list_addresses (perf_ats, NULL, GNUNET_YES,
ats_perf_cb, NULL);
+ phal = GNUNET_ATS_performance_list_addresses (perf_ats, NULL, GNUNET_YES,
&ats_perf_cb, NULL);
}
return GNUNET_OK;
}
Modified: gnunet/src/ats/test_ats_solver_add_address.c
===================================================================
--- gnunet/src/ats/test_ats_solver_add_address.c 2014-06-16 09:34:22 UTC
(rev 33672)
+++ gnunet/src/ats/test_ats_solver_add_address.c 2014-06-16 10:10:59 UTC
(rev 33673)
@@ -1,10 +1,4 @@
/*
- if (NULL == (perf_ats = GNUNET_ATS_performance_init (cfg, &ats_perf_cb,
NULL)))
- {
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "Failed to connect to performance API\n");
- GNUNET_SCHEDULER_add_now (end_badly, NULL);
- }
This file is part of GNUnet.
(C) 2010-2013 Christian Grothoff (and other contributing authors)
Modified: gnunet/src/ats/test_ats_solver_alternative_after_delete_address.c
===================================================================
--- gnunet/src/ats/test_ats_solver_alternative_after_delete_address.c
2014-06-16 09:34:22 UTC (rev 33672)
+++ gnunet/src/ats/test_ats_solver_alternative_after_delete_address.c
2014-06-16 10:10:59 UTC (rev 33673)
@@ -1,10 +1,4 @@
/*
- if (NULL == (perf_ats = GNUNET_ATS_performance_init (cfg, &ats_perf_cb,
NULL)))
- {
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "Failed to connect to performance API\n");
- GNUNET_SCHEDULER_add_now (end_badly, NULL);
- }
This file is part of GNUnet.
(C) 2010-2013 Christian Grothoff (and other contributing authors)
Modified: gnunet/src/ats-tests/ats-testing.c
===================================================================
--- gnunet/src/ats-tests/ats-testing.c 2014-06-16 09:34:22 UTC (rev 33672)
+++ gnunet/src/ats-tests/ats-testing.c 2014-06-16 10:10:59 UTC (rev 33673)
@@ -541,14 +541,15 @@
}
}
+
static void
ats_performance_info_cb (void *cls,
- const struct GNUNET_HELLO_Address *address,
- int address_active,
- struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out,
- struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in,
- const struct GNUNET_ATS_Information *ats,
- uint32_t ats_count)
+ const struct GNUNET_HELLO_Address *address,
+ int address_active,
+ struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out,
+ struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in,
+ const struct GNUNET_ATS_Information *ats,
+ uint32_t ats_count)
{
struct BenchmarkPeer *me = cls;
struct BenchmarkPartner *p;
@@ -556,8 +557,6 @@
int log;
char *peer_id;
-
-
p = find_partner (me, &address->peer);
if (NULL == p)
{
@@ -634,8 +633,11 @@
}
}
if (GNUNET_YES == log)
- top->ats_perf_cb (cls, address, address_active, bandwidth_out,
bandwidth_in,
- ats, ats_count);
+ top->ats_perf_cb (cls, address,
+ address_active,
+ bandwidth_out,
+ bandwidth_in,
+ ats, ats_count);
GNUNET_free(peer_id);
}
@@ -646,7 +648,9 @@
{
struct BenchmarkPeer *me = cls;
- me->ats_perf_handle = GNUNET_ATS_performance_init (cfg,
ats_performance_info_cb, me);
+ me->ats_perf_handle = GNUNET_ATS_performance_init (cfg,
+ &ats_performance_info_cb,
+ me);
if (NULL == me->ats_perf_handle)
GNUNET_log(GNUNET_ERROR_TYPE_ERROR,
"Failed to create ATS performance handle \n");
@@ -857,6 +861,7 @@
return &top->mps[src].partners[dest];
}
+
/**
* Create a topology for ats testing
*
@@ -872,15 +877,14 @@
*/
void
GNUNET_ATS_TEST_create_topology (char *name, char *cfg_file,
- unsigned int num_slaves,
- unsigned int num_masters,
- int test_core,
- GNUNET_ATS_TEST_TopologySetupDoneCallback done_cb,
- void *done_cb_cls,
- GNUNET_TRANSPORT_ReceiveCallback transport_recv_cb,
- GNUNET_ATS_AddressInformationCallback log_request_cb)
+ unsigned int num_slaves,
+ unsigned int num_masters,
+ int test_core,
+ GNUNET_ATS_TEST_TopologySetupDoneCallback
done_cb,
+ void *done_cb_cls,
+ GNUNET_TRANSPORT_ReceiveCallback
transport_recv_cb,
+ GNUNET_ATS_AddressInformationCallback
log_request_cb)
{
-
static struct GNUNET_CORE_MessageHandler handlers[] = {
{&comm_handle_ping, TEST_MESSAGE_TYPE_PING, 0 },
{&comm_handle_pong, TEST_MESSAGE_TYPE_PONG, 0 },
@@ -894,7 +898,7 @@
top->done_cb_cls = done_cb_cls;
top->test_core = test_core;
top->transport_recv_cb = transport_recv_cb;
- top->ats_perf_cb = log_request_cb;
+ top->ats_perf_cb = &log_request_cb;
top->mps = GNUNET_malloc (num_masters * sizeof (struct BenchmarkPeer));
top->sps = GNUNET_malloc (num_slaves * sizeof (struct BenchmarkPeer));
@@ -905,10 +909,13 @@
event_mask |= (1LL << GNUNET_TESTBED_ET_CONNECT);
event_mask |= (1LL << GNUNET_TESTBED_ET_OPERATION_FINISHED);
(void) GNUNET_TESTBED_test_run (name, cfg_file,
- num_slaves + num_masters, event_mask, &controller_event_cb, NULL,
- &main_run, NULL);
+ num_slaves + num_masters,
+ event_mask,
+ &controller_event_cb, NULL,
+ &main_run, NULL);
}
+
/**
* Shutdown topology
*/
@@ -917,7 +924,6 @@
{
if (NULL == top)
return;
-
GNUNET_SCHEDULER_shutdown();
}
Modified: gnunet/src/ats-tests/gnunet-solver-eval.c
===================================================================
--- gnunet/src/ats-tests/gnunet-solver-eval.c 2014-06-16 09:34:22 UTC (rev
33672)
+++ gnunet/src/ats-tests/gnunet-solver-eval.c 2014-06-16 10:10:59 UTC (rev
33673)
@@ -33,7 +33,6 @@
/**
* Experiments
*/
-
const char *
print_op (enum OperationType op)
{
Modified: gnunet/src/ats-tool/gnunet-ats.c
===================================================================
--- gnunet/src/ats-tool/gnunet-ats.c 2014-06-16 09:34:22 UTC (rev 33672)
+++ gnunet/src/ats-tool/gnunet-ats.c 2014-06-16 10:10:59 UTC (rev 33673)
@@ -438,7 +438,7 @@
ntohl (pr->bandwidth_out.value__),
ntohl (pr->bandwidth_in.value__),
ats_str);
- GNUNET_free(ats_str);
+ GNUNET_free (ats_str);
}
@@ -490,8 +490,10 @@
*
* @param cls closure (NULL)
* @param address the address, NULL if ATS service was disconnected
- * @param address_active is this address actively used to maintain a connection
- to a peer
+ * @param active #GNUNET_YES if this address is actively used
+ * to maintain a connection to a peer;
+ * #GNUNET_NO if the address is not actively used;
+ * #GNUNET_SYSERR if this address is no longer available for ATS
* @param bandwidth_out assigned outbound bandwidth for the connection
* @param bandwidth_in assigned inbound bandwidth for the connection
* @param ats performance data for the address (as far as known)
@@ -528,7 +530,35 @@
NULL);
return;
}
+ if (GNUNET_SYSERR == active)
+ {
+ /* remove address */
+ struct AddressFindCtx actx;
+ actx.src = address;
+ actx.res = NULL;
+ GNUNET_CONTAINER_multipeermap_get_multiple (addresses,
+ &address->peer,
+ &find_address_it,
+ &actx);
+ if (NULL == actx.res)
+ {
+ GNUNET_break (0);
+ return;
+ }
+ GNUNET_break (GNUNET_OK ==
+ GNUNET_CONTAINER_multipeermap_remove (addresses,
+ &address->peer,
+ actx.res));
+ FPRINTF (stderr,
+ _("Removed address of peer `%s' with plugin `%s'\n"),
+ GNUNET_i2s (&address->peer),
+ actx.res->address->transport_name);
+ GNUNET_HELLO_address_free (actx.res);
+ GNUNET_free (actx.res);
+ return;
+ }
+
if (GNUNET_NO == verbose)
{
struct AddressFindCtx actx;
@@ -536,7 +566,6 @@
actx.src = address;
actx.res = NULL;
-
GNUNET_CONTAINER_multipeermap_get_multiple (addresses,
&address->peer,
&find_address_it,
@@ -836,7 +865,11 @@
_("Cannot connect to ATS service, exiting...\n"));
alh = GNUNET_ATS_performance_list_addresses (ph,
- (NULL == pid_str) ? NULL : &pid, GNUNET_NO, ats_perf_cb, NULL);
+ (NULL == pid_str)
+ ? NULL
+ : &pid,
+ GNUNET_NO,
+ &ats_perf_cb, NULL);
if (NULL == alh)
{
FPRINTF (stderr,
Modified: gnunet/src/dv/gnunet-service-dv.c
===================================================================
--- gnunet/src/dv/gnunet-service-dv.c 2014-06-16 09:34:22 UTC (rev 33672)
+++ gnunet/src/dv/gnunet-service-dv.c 2014-06-16 10:10:59 UTC (rev 33673)
@@ -1302,7 +1302,10 @@
*
* @param cls closure
* @param address the address
- * @param active is this address in active use
+ * @param active #GNUNET_YES if this address is actively used
+ * to maintain a connection to a peer;
+ * #GNUNET_NO if the address is not actively used;
+ * #GNUNET_SYSERR if this address is no longer available for ATS
* @param bandwidth_out assigned outbound bandwidth for the connection
* @param bandwidth_in assigned inbound bandwidth for the connection
* @param ats performance data for the address (as far as known)
@@ -1327,8 +1330,11 @@
return;
}
- if (GNUNET_NO == active)
+ if (GNUNET_YES != active)
+ {
+ // FIXME: handle disconnect/inactive case too!
return;
+ }
distance = get_atsi_distance (ats, ats_count);
network = get_atsi_network (ats, ats_count);
GNUNET_break (GNUNET_ATS_NET_UNSPECIFIED != network);
Modified: gnunet/src/fs/gnunet-service-fs.c
===================================================================
--- gnunet/src/fs/gnunet-service-fs.c 2014-06-16 09:34:22 UTC (rev 33672)
+++ gnunet/src/fs/gnunet-service-fs.c 2014-06-16 10:10:59 UTC (rev 33673)
@@ -261,7 +261,7 @@
}
if (GNUNET_YES != active)
- return;
+ return;
for (i = 0; i < ats_count; i++)
{
if (GNUNET_ATS_QUALITY_NET_DELAY != ntohl (ats[i].type))
Modified: gnunet/src/include/gnunet_ats_service.h
===================================================================
--- gnunet/src/include/gnunet_ats_service.h 2014-06-16 09:34:22 UTC (rev
33672)
+++ gnunet/src/include/gnunet_ats_service.h 2014-06-16 10:10:59 UTC (rev
33673)
@@ -759,8 +759,10 @@
*
* @param cls closure
* @param address the address, NULL if ATS service was disconnected
- * @param address_active is this address actively used to maintain a connection
- to a peer
+ * @param address_active #GNUNET_YES if this address is actively used
+ * to maintain a connection to a peer;
+ * #GNUNET_NO if the address is not actively used;
+ * #GNUNET_SYSERR if this address is no longer available for ATS
* @param bandwidth_out assigned outbound bandwidth for the connection
* @param bandwidth_in assigned inbound bandwidth for the connection
* @param ats performance data for the address (as far as known)
@@ -768,13 +770,14 @@
*/
typedef void
(*GNUNET_ATS_AddressInformationCallback) (void *cls,
- const struct GNUNET_HELLO_Address *address,
- int address_active,
- struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out,
- struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in,
- const struct GNUNET_ATS_Information *ats,
- uint32_t ats_count);
+ const struct GNUNET_HELLO_Address
*address,
+ int address_active,
+ struct GNUNET_BANDWIDTH_Value32NBO
bandwidth_out,
+ struct GNUNET_BANDWIDTH_Value32NBO
bandwidth_in,
+ const struct GNUNET_ATS_Information
*ats,
+ uint32_t ats_count);
+
/**
* Handle for an address listing operation
*/
@@ -792,10 +795,11 @@
*/
struct GNUNET_ATS_PerformanceHandle *
GNUNET_ATS_performance_init (const struct GNUNET_CONFIGURATION_Handle *cfg,
- GNUNET_ATS_AddressInformationCallback addr_info_cb,
+ GNUNET_ATS_AddressInformationCallback
addr_info_cb,
void *addr_info_cb_cls);
+
/**
* Get information about addresses known to the ATS subsystem.
*
@@ -805,14 +809,15 @@
* get only address currently used
* @param infocb callback to call with the addresses,
* will callback with address == NULL when done
- * @param infocb_cls closure for infocb
+ * @param infocb_cls closure for @a infocb
* @return ats performance context
*/
struct GNUNET_ATS_AddressListHandle *
-GNUNET_ATS_performance_list_addresses (
- struct GNUNET_ATS_PerformanceHandle *handle,
- const struct GNUNET_PeerIdentity *peer, int all,
- GNUNET_ATS_AddressInformationCallback infocb, void *infocb_cls);
+GNUNET_ATS_performance_list_addresses (struct GNUNET_ATS_PerformanceHandle
*handle,
+ const struct GNUNET_PeerIdentity *peer,
+ int all,
+ GNUNET_ATS_AddressInformationCallback
infocb,
+ void *infocb_cls);
/**
@@ -845,8 +850,9 @@
*/
typedef void
(*GNUNET_ATS_ReservationCallback) (void *cls,
- const struct GNUNET_PeerIdentity * peer, int32_t amount,
- struct GNUNET_TIME_Relative res_delay);
+ const struct GNUNET_PeerIdentity * peer,
+ int32_t amount,
+ struct GNUNET_TIME_Relative res_delay);
/**
Modified: gnunet/src/testbed/gnunet-daemon-latency-logger.c
===================================================================
--- gnunet/src/testbed/gnunet-daemon-latency-logger.c 2014-06-16 09:34:22 UTC
(rev 33672)
+++ gnunet/src/testbed/gnunet-daemon-latency-logger.c 2014-06-16 10:10:59 UTC
(rev 33673)
@@ -21,7 +21,7 @@
/**
* @file testbed/gnunet-daemon-latency-logger.c
* @brief log latency values from neighbour connections into an SQLite database
- * @author Sree Harsha Totakura <address@hidden>
+ * @author Sree Harsha Totakura <address@hidden>
*/
#include "platform.h"
@@ -71,7 +71,7 @@
* The last known value for latency
*/
unsigned int latency;
-
+
};
@@ -119,7 +119,7 @@
{
struct Entry *e = cls;
- GNUNET_assert (GNUNET_YES ==
+ GNUNET_assert (GNUNET_YES ==
GNUNET_CONTAINER_multipeermap_remove (map, key, e));
GNUNET_free (e);
return GNUNET_YES;
@@ -131,7 +131,7 @@
*
* @param cls NULL
* @param tc task context from scheduler
- * @return
+ * @return
*/
static void
do_shutdown (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
@@ -148,7 +148,7 @@
db = NULL;
if (NULL != map)
{
- GNUNET_assert (GNUNET_SYSERR !=
+ GNUNET_assert (GNUNET_SYSERR !=
GNUNET_CONTAINER_multipeermap_iterate (map, free_iterator,
NULL));
GNUNET_CONTAINER_multipeermap_destroy (map);
map = NULL;
@@ -160,8 +160,10 @@
*
* @param cls closure
* @param address the address
- * @param address_active is this address actively used to maintain a connection
- * to a peer
+ * @param address_active #GNUNET_YES if this address is actively used
+ * to maintain a connection to a peer;
+ * #GNUNET_NO if the address is not actively used;
+ * #GNUNET_SYSERR if this address is no longer available for ATS
* @param bandwidth_out assigned outbound bandwidth for the connection
* @param bandwidth_in assigned inbound bandwidth for the connection
* @param ats performance data for the address (as far as known)
@@ -197,7 +199,7 @@
}
GNUNET_assert (NULL != db);
- if (GNUNET_NO == address_active)
+ if (GNUNET_YES != address_active)
return;
for (cnt = 0; cnt < ats_count; cnt++)
{
@@ -248,13 +250,13 @@
{
entry = GNUNET_new (struct Entry);
entry->id = address->peer;
- GNUNET_CONTAINER_multipeermap_put (map,
+ GNUNET_CONTAINER_multipeermap_put (map,
&entry->id, entry,
GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST);
}
entry->latency = latency;
return;
-
+
err_shutdown:
GNUNET_SCHEDULER_shutdown ();
}
@@ -272,7 +274,7 @@
run (void *cls, char *const *args, const char *cfgfile,
const struct GNUNET_CONFIGURATION_Handle *c)
{
- const char *query_create =
+ const char *query_create =
"CREATE TABLE ats_info ("
"id TEXT,"
"val INTEGER,"
@@ -303,9 +305,9 @@
DEBUG ("SQLite Error: %d. Perhaps the database `%s' already exits.\n",
sqlite3_errcode (db), dbfile);
DEBUG ("Opened database %s\n", dbfile);
- GNUNET_free (dbfile);
+ GNUNET_free (dbfile);
dbfile = NULL;
- ats = GNUNET_ATS_performance_init (c, addr_info_cb, NULL);
+ ats = GNUNET_ATS_performance_init (c, &addr_info_cb, NULL);
map = GNUNET_CONTAINER_multipeermap_create (30, GNUNET_YES);
shutdown_task = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL,
&do_shutdown, NULL);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r33673 - in gnunet/src: ats ats-tests ats-tool dv fs include testbed,
gnunet <=