/*
This file is part of GNUnet.
- (C) 2010,2011 Christian Grothoff (and other contributing authors)
+ Copyright (C) 2010,2011 GNUnet e.V.
GNUnet is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published
You should have received a copy of the GNU General Public License
along with GNUnet; see the file COPYING. If not, write to the
- Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- Boston, MA 02111-1307, USA.
+ Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
*/
/**
* @file ats/ats_api_performance.c
#include "gnunet_ats_service.h"
#include "ats.h"
+
+#define LOG(kind,...) GNUNET_log_from(kind, "ats-performance-api", __VA_ARGS__)
+
+
/**
* Message in linked list we should send to the ATS service. The
* actual binary message follows this struct.
GNUNET_ATS_AddressInformationCallback cb;
/**
- * Callback closure
+ * Callback closure for @e cb
*/
void *cb_cls;
/**
* Task to trigger reconnect.
*/
- GNUNET_SCHEDULER_TaskIdentifier task;
+ struct GNUNET_SCHEDULER_Task *task;
+
+ /**
+ * Reconnect backoff delay.
+ */
+ struct GNUNET_TIME_Relative backoff;
/**
* Monitor request multiplexing
* Request multiplexing
*/
uint32_t id;
+
+ /**
+ * Is the receive loop active?
+ */
+ int in_receive;
};
/**
* Re-establish the connection to the ATS service.
*
* @param cls handle to use to re-connect.
- * @param tc scheduler context
*/
static void
-reconnect_task (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+reconnect_task (void *cls)
{
struct GNUNET_ATS_PerformanceHandle *ph = cls;
- ph->task = GNUNET_SCHEDULER_NO_TASK;
+ ph->task = NULL;
reconnect (ph);
}
/**
* We can now transmit a message to ATS. Do it.
*
- * @param cls the 'struct GNUNET_ATS_SchedulingHandle'
+ * @param cls the `struct GNUNET_ATS_PerformanceHandle`
* @param size number of bytes we can transmit to ATS
* @param buf where to copy the messages
- * @return number of bytes copied into buf
+ * @return number of bytes copied into @a buf
*/
static size_t
-transmit_message_to_ats (void *cls, size_t size, void *buf)
+transmit_message_to_ats (void *cls,
+ size_t size,
+ void *buf)
{
struct GNUNET_ATS_PerformanceHandle *ph = cls;
struct PendingMessage *p;
memcpy (&cbuf[ret], &p[1], p->size);
ret += p->size;
size -= p->size;
- GNUNET_CONTAINER_DLL_remove(ph->pending_head, ph->pending_tail, p);
+ GNUNET_CONTAINER_DLL_remove (ph->pending_head,
+ ph->pending_tail,
+ p);
GNUNET_free(p);
}
do_transmit (ph);
+ if (GNUNET_NO == ph->in_receive)
+ {
+ ph->in_receive = GNUNET_YES;
+ GNUNET_CLIENT_receive (ph->client,
+ &process_ats_message,
+ ph,
+ GNUNET_TIME_UNIT_FOREVER_REL);
+ }
return ret;
}
return;
if (NULL == ph->client)
return; /* currently reconnecting */
- ph->th = GNUNET_CLIENT_notify_transmit_ready (ph->client, p->size,
- GNUNET_TIME_UNIT_FOREVER_REL, GNUNET_YES, &transmit_message_to_ats, ph);
+ ph->th = GNUNET_CLIENT_notify_transmit_ready (ph->client,
+ p->size,
+ GNUNET_TIME_UNIT_FOREVER_REL,
+ GNUNET_YES,
+ &transmit_message_to_ats, ph);
}
const struct GNUNET_MessageHeader *msg)
{
const struct PeerInformationMessage *pi;
- const struct GNUNET_ATS_Information *atsi;
const char *plugin_address;
const char *plugin_name;
struct GNUNET_HELLO_Address address;
uint16_t plugin_address_length;
uint16_t plugin_name_length;
- uint32_t ats_count;
int addr_active;
+ struct GNUNET_ATS_Properties prop;
if (ntohs (msg->size) < sizeof(struct PeerInformationMessage))
{
GNUNET_break(0);
return GNUNET_SYSERR;
}
-
pi = (const struct PeerInformationMessage *) msg;
- 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);
- atsi = (const struct GNUNET_ATS_Information *) &pi[1];
- plugin_address = (const char *) &atsi[ats_count];
+ addr_active = (int) ntohl (pi->address_active);
+ plugin_address = (const char *) &pi[1];
plugin_name = &plugin_address[plugin_address_length];
if ((plugin_address_length + plugin_name_length
- + ats_count * sizeof(struct GNUNET_ATS_Information)
+ sizeof(struct PeerInformationMessage) != ntohs (msg->size))
- || (ats_count
- > GNUNET_SERVER_MAX_MESSAGE_SIZE
- / sizeof(struct GNUNET_ATS_Information))
|| (plugin_name[plugin_name_length - 1] != '\0'))
{
GNUNET_break(0);
if (NULL != ph->addr_info_cb)
{
+ GNUNET_ATS_properties_ntoh (&prop,
+ &pi->properties);
address.peer = pi->peer;
+ address.local_info = (enum GNUNET_HELLO_AddressInfo) ntohl (pi->address_local_info);
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,
pi->bandwidth_out,
pi->bandwidth_in,
- atsi, ats_count);
+ &prop);
}
return GNUNET_OK;
}
GNUNET_break(0);
return GNUNET_SYSERR;
}
- GNUNET_CONTAINER_DLL_remove(ph->reservation_head, ph->reservation_tail, rc);
- if ((amount == 0) || (rc->rcb != NULL ))
+ GNUNET_CONTAINER_DLL_remove (ph->reservation_head,
+ ph->reservation_tail,
+ rc);
+ if ( (0 == amount) ||
+ (NULL != rc->rcb) )
{
/* tell client if not cancelled */
if (rc->rcb != NULL )
- rc->rcb (rc->rcb_cls, &rr->peer, amount,
- GNUNET_TIME_relative_ntoh (rr->res_delay));
+ rc->rcb (rc->rcb_cls,
+ &rr->peer,
+ amount,
+ GNUNET_TIME_relative_ntoh (rr->res_delay));
GNUNET_free(rc);
return GNUNET_OK;
}
return GNUNET_OK; /* do not try to undo failed undos or negative amounts */
}
GNUNET_free(rc);
- (void) GNUNET_ATS_reserve_bandwidth (ph, &rr->peer, -amount, NULL, NULL );
+ (void) GNUNET_ATS_reserve_bandwidth (ph,
+ &rr->peer,
+ -amount,
+ NULL, NULL);
return GNUNET_OK;
}
/**
- * We received a reservation result message. Validate and process it.
+ * We received a PeerInformationMessage. Validate and process it.
*
* @param ph our context with the callback
* @param msg the message
const struct PeerInformationMessage *pi;
struct GNUNET_ATS_AddressListHandle *alh;
struct GNUNET_ATS_AddressListHandle *next;
- const struct GNUNET_ATS_Information *atsi;
const char *plugin_address;
const char *plugin_name;
struct GNUNET_HELLO_Address address;
struct GNUNET_PeerIdentity allzeros;
struct GNUNET_BANDWIDTH_Value32NBO bandwidth_zero;
+ struct GNUNET_ATS_Properties prop;
uint16_t plugin_address_length;
uint16_t plugin_name_length;
- uint32_t ats_count;
uint32_t active;
uint32_t id;
GNUNET_break(0);
return GNUNET_SYSERR;
}
- GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, _("Received %s message\n"),
- "ATS_ADDRESSLIST_RESPONSE");
-
pi = (const struct PeerInformationMessage *) msg;
id = ntohl (pi->id);
- ats_count = ntohl (pi->ats_count);
active = ntohl (pi->address_active);
plugin_address_length = ntohs (pi->address_length);
plugin_name_length = ntohs (pi->plugin_name_length);
- atsi = (const struct GNUNET_ATS_Information *) &pi[1];
- plugin_address = (const char *) &atsi[ats_count];
+ plugin_address = (const char *) &pi[1];
plugin_name = &plugin_address[plugin_address_length];
- if ((plugin_address_length + plugin_name_length
- + ats_count * sizeof(struct GNUNET_ATS_Information)
- + sizeof(struct PeerInformationMessage) != ntohs (msg->size))
- || (ats_count
- > GNUNET_SERVER_MAX_MESSAGE_SIZE
- / sizeof(struct GNUNET_ATS_Information))
- || (plugin_name[plugin_name_length - 1] != '\0'))
+ if ( (plugin_address_length + plugin_name_length
+ + sizeof (struct PeerInformationMessage) != ntohs (msg->size)) ||
+ (plugin_name[plugin_name_length - 1] != '\0') )
{
GNUNET_break(0);
return GNUNET_SYSERR;
}
+ LOG (GNUNET_ERROR_TYPE_DEBUG,
+ "Received ATS_ADDRESSLIST_RESPONSE message for peer %s and plugin %s\n",
+ GNUNET_i2s (&pi->peer),
+ plugin_name);
next = ph->addresslist_head;
while (NULL != (alh = next))
return GNUNET_SYSERR;
}
- memset (&allzeros, '\0', sizeof(allzeros));
- if ((0 == memcmp (&allzeros, &pi->peer, sizeof(allzeros)))
- && (0 == plugin_name_length) && (0 == plugin_address_length)
- && (0 == ats_count))
+ memset (&allzeros, '\0', sizeof (allzeros));
+ if ( (0 == memcmp (&allzeros, &pi->peer, sizeof(allzeros))) &&
+ (0 == plugin_name_length) &&
+ (0 == plugin_address_length) )
{
/* Done */
- GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, _("Received last message for %s \n"),
- "ATS_ADDRESSLIST_RESPONSE");
+ LOG (GNUNET_ERROR_TYPE_DEBUG,
+ "Received last message for ATS_ADDRESSLIST_RESPONSE\n");
bandwidth_zero.value__ = htonl (0);
+ GNUNET_CONTAINER_DLL_remove (ph->addresslist_head,
+ ph->addresslist_tail,
+ alh);
if (NULL != alh->cb)
- alh->cb (ph->addr_info_cb_cls, NULL, GNUNET_NO, bandwidth_zero,
- bandwidth_zero, NULL, 0);
- GNUNET_CONTAINER_DLL_remove(ph->addresslist_head, ph->addresslist_tail,
- alh);
- GNUNET_free(alh);
+ alh->cb (alh->cb_cls,
+ NULL,
+ GNUNET_NO,
+ bandwidth_zero,
+ bandwidth_zero,
+ NULL);
+ GNUNET_free (alh);
return GNUNET_OK;
}
address.address = plugin_address;
address.address_length = plugin_address_length;
address.transport_name = plugin_name;
-
- if ((GNUNET_YES == alh->all_addresses) || (GNUNET_YES == active))
+ if ( ( (GNUNET_YES == alh->all_addresses) ||
+ (GNUNET_YES == active) ) &&
+ (NULL != alh->cb) )
{
- if (NULL != alh->cb)
- alh->cb (ph->addr_info_cb_cls, &address, active, pi->bandwidth_out,
- pi->bandwidth_in, atsi, ats_count);
+ GNUNET_ATS_properties_ntoh (&prop,
+ &pi->properties);
+ alh->cb (alh->cb_cls,
+ &address,
+ active,
+ pi->bandwidth_out,
+ pi->bandwidth_in,
+ &prop);
}
return GNUNET_OK;
}
* @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;
{
case GNUNET_MESSAGE_TYPE_ATS_PEER_INFORMATION:
if (GNUNET_OK != process_pi_message (ph, msg))
+ {
+ GNUNET_break (0);
goto reconnect;
+ }
break;
case GNUNET_MESSAGE_TYPE_ATS_RESERVATION_RESULT:
if (GNUNET_OK != process_rr_message (ph, msg))
+ {
+ GNUNET_break (0);
goto reconnect;
+ }
break;
case GNUNET_MESSAGE_TYPE_ATS_ADDRESSLIST_RESPONSE:
if (GNUNET_OK != process_ar_message (ph, msg))
+ {
+ GNUNET_break (0);
goto reconnect;
+ }
break;
default:
- GNUNET_break(0);
+ GNUNET_break (0);
goto reconnect;
}
- GNUNET_CLIENT_receive (ph->client, &process_ats_message, ph,
- GNUNET_TIME_UNIT_FOREVER_REL);
+ ph->backoff = GNUNET_TIME_UNIT_ZERO;
+ GNUNET_CLIENT_receive (ph->client,
+ &process_ats_message,
+ ph,
+ GNUNET_TIME_UNIT_FOREVER_REL);
return;
reconnect:
+ LOG (GNUNET_ERROR_TYPE_DEBUG,
+ "Reconnecting!\n");
if (NULL != ph->th)
{
GNUNET_CLIENT_notify_transmit_ready_cancel (ph->th);
ph->th = NULL;
}
- GNUNET_CLIENT_disconnect (ph->client);
- ph->client = NULL;
- if (NULL != ph->addr_info_cb)
+ if (NULL != ph->client)
{
- /* Indicate reconnect */
- ph->addr_info_cb (ph->addr_info_cb_cls, NULL, GNUNET_NO,
- GNUNET_BANDWIDTH_value_init (0),
- GNUNET_BANDWIDTH_value_init(0),
- NULL, 0);
+ GNUNET_CLIENT_disconnect (ph->client);
+ ph->client = NULL;
+ ph->in_receive = GNUNET_NO;
+ if (NULL != ph->addr_info_cb)
+ {
+ /* Indicate reconnect */
+ ph->addr_info_cb (ph->addr_info_cb_cls,
+ NULL,
+ GNUNET_NO,
+ GNUNET_BANDWIDTH_value_init (0),
+ GNUNET_BANDWIDTH_value_init (0),
+ NULL);
+ }
}
- ph->task = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_SECONDS,
- &reconnect_task, ph);
+ ph->backoff = GNUNET_TIME_STD_BACKOFF (ph->backoff);
+ ph->task = GNUNET_SCHEDULER_add_delayed (ph->backoff,
+ &reconnect_task,
+ ph);
}
struct PendingMessage *p;
struct ClientStartMessage *init;
- GNUNET_assert(NULL == ph->client);
- ph->client = GNUNET_CLIENT_connect ("ats", ph->cfg);
- GNUNET_assert(NULL != ph->client);
- GNUNET_CLIENT_receive (ph->client, &process_ats_message, ph,
- GNUNET_TIME_UNIT_FOREVER_REL);
+ GNUNET_assert (NULL == ph->client);
+ ph->client = GNUNET_CLIENT_connect ("ats",
+ ph->cfg);
+ GNUNET_assert (NULL != ph->client);
if ((NULL == (p = ph->pending_head)) || (GNUNET_YES != p->is_init))
{
p = GNUNET_malloc (sizeof (struct PendingMessage) +
init = (struct ClientStartMessage *) &p[1];
init->header.type = htons (GNUNET_MESSAGE_TYPE_ATS_START);
init->header.size = htons (sizeof(struct ClientStartMessage));
- init->start_flag = htonl (
- (NULL == ph->addr_info_cb) ?
- START_FLAG_PERFORMANCE_NO_PIC : START_FLAG_PERFORMANCE_WITH_PIC);
- GNUNET_CONTAINER_DLL_insert(ph->pending_head, ph->pending_tail, p);
+ init->start_flag = htonl ( (NULL == ph->addr_info_cb)
+ ? START_FLAG_PERFORMANCE_NO_PIC
+ : START_FLAG_PERFORMANCE_WITH_PIC);
+ GNUNET_CONTAINER_DLL_insert (ph->pending_head,
+ ph->pending_tail,
+ p);
}
do_transmit (ph);
}
* @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 *
while (NULL != (p = ph->pending_head))
{
- GNUNET_CONTAINER_DLL_remove(ph->pending_head, ph->pending_tail, p);
- GNUNET_free(p);
+ GNUNET_CONTAINER_DLL_remove (ph->pending_head,
+ ph->pending_tail,
+ p);
+ GNUNET_free (p);
}
while (NULL != (alh = ph->addresslist_head))
{
- GNUNET_CONTAINER_DLL_remove(ph->addresslist_head, ph->addresslist_tail,
- alh);
- GNUNET_free(alh);
+ GNUNET_CONTAINER_DLL_remove (ph->addresslist_head,
+ ph->addresslist_tail,
+ alh);
+ GNUNET_free (alh);
}
while (NULL != (rc = ph->reservation_head))
{
- GNUNET_CONTAINER_DLL_remove(ph->reservation_head, ph->reservation_tail, rc);
- GNUNET_break(NULL == rc->rcb);
- GNUNET_free(rc);
+ GNUNET_CONTAINER_DLL_remove (ph->reservation_head,
+ ph->reservation_tail,
+ rc);
+ GNUNET_break (NULL == rc->rcb);
+ GNUNET_free (rc);
}
- if (GNUNET_SCHEDULER_NO_TASK != ph->task)
+ if (NULL != ph->task)
{
GNUNET_SCHEDULER_cancel (ph->task);
- ph->task = GNUNET_SCHEDULER_NO_TASK;
+ ph->task = NULL;
}
if (NULL != ph->client)
{
GNUNET_CLIENT_disconnect (ph->client);
ph->client = NULL;
}
- GNUNET_free(ph);
+ GNUNET_free (ph);
}
* @param amount reserve N bytes for receiving, negative
* amounts can be used to undo a (recent) reservation;
* @param rcb function to call with the resulting reservation information
- * @param rcb_cls closure for info
+ * @param rcb_cls closure for @a rcb
* @return NULL on error
* @deprecated will be replaced soon
*/
rc->peer = *peer;
rc->rcb = rcb;
rc->rcb_cls = rcb_cls;
- if ((rcb != NULL )&& (amount > 0))rc->undo = GNUNET_YES;
- GNUNET_CONTAINER_DLL_insert_tail(ph->reservation_head, ph->reservation_tail,
- rc);
+ if ( (NULL != rcb) &&
+ (amount > 0) )
+ rc->undo = GNUNET_YES;
+ GNUNET_CONTAINER_DLL_insert_tail (ph->reservation_head,
+ ph->reservation_tail,
+ rc);
p = GNUNET_malloc (sizeof (struct PendingMessage) +
sizeof (struct ReservationRequestMessage));
m->header.size = htons (sizeof(struct ReservationRequestMessage));
m->amount = htonl (amount);
m->peer = *peer;
- GNUNET_CONTAINER_DLL_insert_tail(ph->pending_head, ph->pending_tail, p);
+ GNUNET_CONTAINER_DLL_insert_tail (ph->pending_head,
+ ph->pending_tail,
+ p);
do_transmit (ph);
return rc;
}
*
* @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
- * @param infocb_cls closure for infocb
+ * @param infocb_cls closure for @a infocb
* @return ats performance context
*/
struct GNUNET_ATS_AddressListHandle*
struct PendingMessage *p;
struct AddressListRequestMessage *m;
- GNUNET_assert(NULL != handle);
if (NULL == infocb)
- return NULL ;
-
+ return NULL;
alh = GNUNET_new (struct GNUNET_ATS_AddressListHandle);
alh->id = handle->id;
handle->id++;
alh->ph = handle;
alh->all_addresses = all;
if (NULL == peer)
+ {
alh->all_peers = GNUNET_YES;
+ }
else
{
alh->all_peers = GNUNET_NO;
- alh->peer = (*peer);
+ alh->peer = *peer;
}
-
- GNUNET_CONTAINER_DLL_insert(handle->addresslist_head,
- handle->addresslist_tail, alh);
+ GNUNET_CONTAINER_DLL_insert (handle->addresslist_head,
+ handle->addresslist_tail,
+ alh);
p = GNUNET_malloc (sizeof (struct PendingMessage) +
- sizeof (struct AddressListRequestMessage));
- p->size = sizeof(struct AddressListRequestMessage);
+ sizeof (struct AddressListRequestMessage));
+ p->size = sizeof (struct AddressListRequestMessage);
m = (struct AddressListRequestMessage *) &p[1];
m->header.type = htons (GNUNET_MESSAGE_TYPE_ATS_ADDRESSLIST_REQUEST);
m->header.size = htons (sizeof(struct AddressListRequestMessage));
m->id = htonl (alh->id);
if (NULL != peer)
m->peer = *peer;
- else
- {
- 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);
return alh;
/**
* Cancel a pending address listing operation
*
- * @param handle the GNUNET_ATS_AddressListHandle handle to cancel
+ * @param handle the handle of the request to cancel
*/
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_CONTAINER_DLL_remove (handle->ph->addresslist_head,
+ handle->ph->addresslist_tail,
+ handle);
+ GNUNET_free (handle);
}
/**
- * Convert a GNUNET_ATS_PreferenceType to a string
+ * Convert a `enum GNUNET_ATS_PreferenceType` to a string
*
* @param type the preference type
* @return a string or NULL if invalid
const char *
GNUNET_ATS_print_preference_type (uint32_t type)
{
- char *prefs[GNUNET_ATS_PreferenceCount] = GNUNET_ATS_PreferenceTypeString;
- if (type < GNUNET_ATS_PreferenceCount)
+ const char *prefs[] = GNUNET_ATS_PreferenceTypeString;
+
+ if (type < GNUNET_ATS_PREFERENCE_END)
return prefs[type];
- return NULL ;
+ return NULL;
}
*
* @param ph performance handle
* @param peer identifies the peer
- * @param ... 0-terminated specification of the desired changes
+ * @param ... #GNUNET_ATS_PREFERENCE_END-terminated specification of the desired changes
*/
void
GNUNET_ATS_performance_change_preference (struct GNUNET_ATS_PerformanceHandle *ph,
count = 0;
va_start(ap, peer);
- while (GNUNET_ATS_PREFERENCE_END != (kind =
- va_arg (ap, enum GNUNET_ATS_PreferenceKind) ))
+ while (GNUNET_ATS_PREFERENCE_END !=
+ (kind = va_arg (ap, enum GNUNET_ATS_PreferenceKind) ))
{
switch (kind)
{
case GNUNET_ATS_PREFERENCE_BANDWIDTH:
count++;
(void) va_arg (ap, double);
-
break;
case GNUNET_ATS_PREFERENCE_LATENCY:
count++;
(void) va_arg (ap, double);
-
break;
default:
GNUNET_assert(0);
* @param ph performance handle
* @param scope the time interval this valid for: [now - scope .. now]
* @param peer identifies the peer
- * @param ... 0-terminated specification of the desired changes
+ * @param ... #GNUNET_ATS_PREFERENCE_END-terminated specification of the desired changes
*/
void
GNUNET_ATS_performance_give_feedback (struct GNUNET_ATS_PerformanceHandle *ph,
count = 0;
va_start(ap, scope);
- while (GNUNET_ATS_PREFERENCE_END != (kind =
- va_arg (ap, enum GNUNET_ATS_PreferenceKind) ))
+ while (GNUNET_ATS_PREFERENCE_END !=
+ (kind = va_arg (ap, enum GNUNET_ATS_PreferenceKind) ))
{
switch (kind)
{
case GNUNET_ATS_PREFERENCE_BANDWIDTH:
count++;
(void) va_arg (ap, double);
-
break;
case GNUNET_ATS_PREFERENCE_LATENCY:
count++;
(void) va_arg (ap, double);
-
break;
default:
GNUNET_assert(0);
}
}
va_end(ap);
- GNUNET_CONTAINER_DLL_insert_tail(ph->pending_head, ph->pending_tail, p);
+ GNUNET_CONTAINER_DLL_insert_tail (ph->pending_head,
+ ph->pending_tail,
+ p);
do_transmit (ph);
}