aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2015-02-10 00:00:56 +0000
committerChristian Grothoff <christian@grothoff.org>2015-02-10 00:00:56 +0000
commite649f10af79eb62bdd1eb0d358538779e3f49235 (patch)
tree8a0a2e77305018be8dd5c85027018da09d569b2a
parent98d966344028d236cc1296ec1fcedb8891774604 (diff)
-fix
-rw-r--r--src/ats/ats_api_connectivity.c21
-rw-r--r--src/ats/ats_api_performance.c22
-rw-r--r--src/ats/ats_api_scanner.c13
-rw-r--r--src/ats/ats_api_scheduling.c68
-rw-r--r--src/transport/gnunet-service-transport_clients.c16
-rw-r--r--src/transport/transport_api.c39
6 files changed, 88 insertions, 91 deletions
diff --git a/src/ats/ats_api_connectivity.c b/src/ats/ats_api_connectivity.c
index 432f1ca359..495a29d932 100644
--- a/src/ats/ats_api_connectivity.c
+++ b/src/ats/ats_api_connectivity.c
@@ -28,6 +28,9 @@
#include "ats.h"
+#define LOG(kind,...) GNUNET_log_from(kind, "ats-connectivity-api", __VA_ARGS__)
+
+
/**
* Handle for ATS address suggestion requests.
*/
@@ -149,9 +152,9 @@ error_handler (void *cls,
{
struct GNUNET_ATS_ConnectivityHandle *ch = cls;
- GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
- "ATS connection died (code %d), reconnecting\n",
- (int) error);
+ LOG (GNUNET_ERROR_TYPE_WARNING,
+ "ATS connection died (code %d), reconnecting\n",
+ (int) error);
force_reconnect (ch);
}
@@ -308,9 +311,9 @@ GNUNET_ATS_connectivity_suggest (struct GNUNET_ATS_ConnectivityHandle *ch,
{
struct GNUNET_ATS_ConnectivitySuggestHandle *s;
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Requesting ATS to suggest address for `%s'\n",
- GNUNET_i2s (peer));
+ LOG (GNUNET_ERROR_TYPE_DEBUG,
+ "Requesting ATS to suggest address for `%s'\n",
+ GNUNET_i2s (peer));
s = GNUNET_new (struct GNUNET_ATS_ConnectivitySuggestHandle);
s->ch = ch;
s->id = *peer;
@@ -344,9 +347,9 @@ GNUNET_ATS_connectivity_suggest_cancel (struct GNUNET_ATS_ConnectivitySuggestHan
struct GNUNET_MQ_Envelope *ev;
struct RequestAddressMessage *m;
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Telling ATS we no longer care for an address for `%s'\n",
- GNUNET_i2s (&sh->id));
+ LOG (GNUNET_ERROR_TYPE_DEBUG,
+ "Telling ATS we no longer care for an address for `%s'\n",
+ GNUNET_i2s (&sh->id));
GNUNET_assert (GNUNET_OK ==
GNUNET_CONTAINER_multipeermap_remove (ch->sug_requests,
&sh->id,
diff --git a/src/ats/ats_api_performance.c b/src/ats/ats_api_performance.c
index e81f0d3943..51980f0794 100644
--- a/src/ats/ats_api_performance.c
+++ b/src/ats/ats_api_performance.c
@@ -27,6 +27,10 @@
#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.
@@ -520,11 +524,10 @@ process_ar_message (struct GNUNET_ATS_PerformanceHandle *ph,
GNUNET_break(0);
return GNUNET_SYSERR;
}
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Received %s message for peer %s and plugin %s\n",
- "ATS_ADDRESSLIST_RESPONSE",
- GNUNET_i2s (&pi->peer),
- plugin_name);
+ 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))
@@ -546,9 +549,8 @@ process_ar_message (struct GNUNET_ATS_PerformanceHandle *ph,
(0 == ats_count) )
{
/* 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,
@@ -622,8 +624,8 @@ process_ats_message (void *cls,
return;
reconnect:
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Reconnecting!\n");
+ LOG (GNUNET_ERROR_TYPE_DEBUG,
+ "Reconnecting!\n");
if (NULL != ph->th)
{
GNUNET_CLIENT_notify_transmit_ready_cancel (ph->th);
diff --git a/src/ats/ats_api_scanner.c b/src/ats/ats_api_scanner.c
index ce1c90567f..64c02acf6a 100644
--- a/src/ats/ats_api_scanner.c
+++ b/src/ats/ats_api_scanner.c
@@ -271,11 +271,12 @@ interface_proc (void *cls,
/* Store in list */
#if VERBOSE_ATS
char * netmask = GNUNET_strdup (GNUNET_a2s((struct sockaddr *) net->netmask, addrlen));
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Adding network `%s', netmask `%s'\n",
- GNUNET_a2s ((struct sockaddr *) net->network,
- addrlen),
- netmask);
+ GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG,
+ "ats-scanner-api",
+ "Adding network `%s', netmask `%s'\n",
+ GNUNET_a2s ((struct sockaddr *) net->network,
+ addrlen),
+ netmask);
GNUNET_free (netmask);
#endif
GNUNET_CONTAINER_DLL_insert (is->net_head,
@@ -392,7 +393,7 @@ GNUNET_ATS_scanner_address_get_type (struct GNUNET_ATS_InterfaceScanner *is,
if (type == GNUNET_ATS_NET_UNSPECIFIED)
type = GNUNET_ATS_NET_WAN;
GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG,
- "ats-scheduling-api",
+ "ats-scanner-api",
"`%s' is in network `%s'\n",
GNUNET_a2s (addr,
addrlen),
diff --git a/src/ats/ats_api_scheduling.c b/src/ats/ats_api_scheduling.c
index fb6df4494e..e4db144d08 100644
--- a/src/ats/ats_api_scheduling.c
+++ b/src/ats/ats_api_scheduling.c
@@ -40,6 +40,7 @@
*/
#define INTERFACE_PROCESSING_INTERVAL GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MINUTES, 2)
+#define LOG(kind,...) GNUNET_log_from(kind, "ats-scheduling-api", __VA_ARGS__)
/**
* Session ID we use if there is no session / slot.
@@ -417,11 +418,11 @@ process_ats_address_suggestion_message (void *cls,
if ( (0 == ntohl (m->bandwidth_out.value__)) &&
(0 == ntohl (m->bandwidth_in.value__)) )
{
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "ATS suggests disconnect from peer `%s' with BW %u/%u\n",
- GNUNET_i2s (&ar->address->peer),
- (unsigned int) ntohl (m->bandwidth_out.value__),
- (unsigned int) ntohl (m->bandwidth_in.value__));
+ LOG (GNUNET_ERROR_TYPE_DEBUG,
+ "ATS suggests disconnect from peer `%s' with BW %u/%u\n",
+ GNUNET_i2s (&ar->address->peer),
+ (unsigned int) ntohl (m->bandwidth_out.value__),
+ (unsigned int) ntohl (m->bandwidth_in.value__));
sh->suggest_cb (sh->suggest_cb_cls,
&m->peer,
NULL,
@@ -439,11 +440,11 @@ process_ats_address_suggestion_message (void *cls,
return;
}
sh->backoff = GNUNET_TIME_UNIT_ZERO;
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "ATS suggests address slot %u for peer `%s' using plugin %s\n",
- ar->slot,
- GNUNET_i2s (&ar->address->peer),
- ar->address->transport_name);
+ LOG (GNUNET_ERROR_TYPE_DEBUG,
+ "ATS suggests address slot %u for peer `%s' using plugin %s\n",
+ ar->slot,
+ GNUNET_i2s (&ar->address->peer),
+ ar->address->transport_name);
sh->suggest_cb (sh->suggest_cb_cls,
&m->peer,
ar->address,
@@ -466,9 +467,9 @@ error_handler (void *cls,
{
struct GNUNET_ATS_SchedulingHandle *sh = cls;
- GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
- "ATS connection died (code %d), reconnecting\n",
- (int) error);
+ LOG (GNUNET_ERROR_TYPE_WARNING,
+ "ATS connection died (code %d), reconnecting\n",
+ (int) error);
force_reconnect (sh);
}
@@ -507,12 +508,12 @@ send_add_address_message (struct GNUNET_ATS_SchedulingHandle *sh,
m->plugin_name_length = htons (namelen);
m->session_id = htonl (ar->slot);
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Adding address for peer `%s', plugin `%s', session %p slot %u\n",
- GNUNET_i2s (&ar->address->peer),
- ar->address->transport_name,
- ar->session,
- ar->slot);
+ LOG (GNUNET_ERROR_TYPE_DEBUG,
+ "Adding address for peer `%s', plugin `%s', session %p slot %u\n",
+ GNUNET_i2s (&ar->address->peer),
+ ar->address->transport_name,
+ ar->session,
+ ar->slot);
am = (struct GNUNET_ATS_Information *) &m[1];
memcpy (am,
ar->ats,
@@ -706,7 +707,10 @@ GNUNET_ATS_address_add (struct GNUNET_ATS_SchedulingHandle *sh,
return NULL;
}
- if (NOT_FOUND != find_session_id (sh, session, address))
+ if (NOT_FOUND !=
+ find_session_id (sh,
+ session,
+ address))
{
/* Already existing, nothing todo, but this should not happen */
GNUNET_break (0);
@@ -796,12 +800,12 @@ GNUNET_ATS_address_update (struct GNUNET_ATS_AddressRecord *ar,
struct GNUNET_ATS_Information *am;
size_t msize;
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Updating address for peer `%s', plugin `%s', session %p slot %u\n",
- GNUNET_i2s (&ar->address->peer),
- ar->address->transport_name,
- ar->session,
- ar->slot);
+ LOG (GNUNET_ERROR_TYPE_DEBUG,
+ "Updating address for peer `%s', plugin `%s', session %p slot %u\n",
+ GNUNET_i2s (&ar->address->peer),
+ ar->address->transport_name,
+ ar->session,
+ ar->slot);
GNUNET_array_grow (ar->ats,
ar->ats_count,
ats_count);
@@ -837,12 +841,12 @@ GNUNET_ATS_address_destroy (struct GNUNET_ATS_AddressRecord *ar)
struct GNUNET_MQ_Envelope *ev;
struct AddressDestroyedMessage *m;
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Deleting address for peer `%s', plugin `%s', slot %u session %p\n",
- GNUNET_i2s (&ar->address->peer),
- ar->address->transport_name,
- ar->slot,
- ar->session);
+ LOG (GNUNET_ERROR_TYPE_DEBUG,
+ "Deleting address for peer `%s', plugin `%s', slot %u session %p\n",
+ GNUNET_i2s (&ar->address->peer),
+ ar->address->transport_name,
+ ar->slot,
+ ar->session);
GNUNET_break (NULL == ar->session);
ar->session = NULL;
ar->in_destroy = GNUNET_YES;
diff --git a/src/transport/gnunet-service-transport_clients.c b/src/transport/gnunet-service-transport_clients.c
index cea1dc14e5..db863ae654 100644
--- a/src/transport/gnunet-service-transport_clients.c
+++ b/src/transport/gnunet-service-transport_clients.c
@@ -646,22 +646,12 @@ clients_handle_start (void *cls,
tc = setup_client (client);
tc->send_payload = (0 != (2 & options));
hello = GST_hello_get ();
- if (NULL == hello)
- {
- /* We are during startup and should have no neighbours, hence
- iteration with NULL must work. The HELLO will be sent to
- all clients once it has been created, so this should happen
- next anyway, and certainly before we get neighbours. */
- GST_neighbours_iterate (NULL, NULL);
- }
- else
- {
+ if (NULL != hello)
unicast (tc,
hello,
GNUNET_NO);
- GST_neighbours_iterate (&notify_client_about_neighbour,
- tc);
- }
+ GST_neighbours_iterate (&notify_client_about_neighbour,
+ tc);
GNUNET_SERVER_receive_done (client,
GNUNET_OK);
}
diff --git a/src/transport/transport_api.c b/src/transport/transport_api.c
index 2da6e9a541..d672b4d460 100644
--- a/src/transport/transport_api.c
+++ b/src/transport/transport_api.c
@@ -689,8 +689,8 @@ demultiplexer (void *cls,
break;
}
LOG (GNUNET_ERROR_TYPE_DEBUG,
- "Receiving `%s' message for `%4s'.\n",
- "CONNECT", GNUNET_i2s (&cim->id));
+ "Receiving CONNECT message for `%4s'.\n",
+ GNUNET_i2s (&cim->id));
n = neighbour_find (h, &cim->id);
if (NULL != n)
{
@@ -699,8 +699,7 @@ demultiplexer (void *cls,
}
n = neighbour_add (h, &cim->id);
LOG (GNUNET_ERROR_TYPE_DEBUG,
- "Receiving `%s' message for `%4s' with quota %u\n",
- "CONNECT",
+ "Receiving CONNECT message for `%4s' with quota %u\n",
GNUNET_i2s (&cim->id),
ntohl (cim->quota_out.value__));
GNUNET_BANDWIDTH_tracker_update_quota (&n->out_tracker,
@@ -717,8 +716,8 @@ demultiplexer (void *cls,
dim = (const struct DisconnectInfoMessage *) msg;
GNUNET_break (ntohl (dim->reserved) == 0);
LOG (GNUNET_ERROR_TYPE_DEBUG,
- "Receiving `%s' message for `%4s'.\n",
- "DISCONNECT", GNUNET_i2s (&dim->peer));
+ "Receiving DISCONNECT message for `%4s'.\n",
+ GNUNET_i2s (&dim->peer));
n = neighbour_find (h, &dim->peer);
if (NULL == n)
{
@@ -766,9 +765,6 @@ demultiplexer (void *cls,
}
break;
case GNUNET_MESSAGE_TYPE_TRANSPORT_RECV:
- LOG (GNUNET_ERROR_TYPE_DEBUG,
- "Receiving `%s' message.\n",
- "RECV");
if (size <
sizeof (struct InboundMessage) + sizeof (struct GNUNET_MessageHeader))
{
@@ -795,8 +791,6 @@ demultiplexer (void *cls,
h->rec (h->cls, &im->peer, imm);
break;
case GNUNET_MESSAGE_TYPE_TRANSPORT_SET_QUOTA:
- LOG (GNUNET_ERROR_TYPE_DEBUG,
- "Receiving `%s' message.\n", "SET_QUOTA");
if (size != sizeof (struct QuotaSetMessage))
{
GNUNET_break (0);
@@ -807,16 +801,18 @@ demultiplexer (void *cls,
if (NULL == n)
break;
LOG (GNUNET_ERROR_TYPE_DEBUG,
- "Receiving `%s' message for `%4s' with quota %u\n",
- "SET_QUOTA",
+ "Receiving SET_QUOTA message for `%4s' with quota %u\n",
GNUNET_i2s (&qm->peer),
ntohl (qm->quota.value__));
- GNUNET_BANDWIDTH_tracker_update_quota (&n->out_tracker, qm->quota);
+ GNUNET_BANDWIDTH_tracker_update_quota (&n->out_tracker,
+ qm->quota);
break;
default:
LOG (GNUNET_ERROR_TYPE_ERROR,
_("Received unexpected message of type %u in %s:%u\n"),
- ntohs (msg->type), __FILE__, __LINE__);
+ ntohs (msg->type),
+ __FILE__,
+ __LINE__);
GNUNET_break (0);
break;
}
@@ -880,11 +876,14 @@ transport_notify_ready (void *cls, size_t size, void *buf)
/* first send control messages */
while ((NULL != (th = h->control_head)) && (th->notify_size <= size))
{
- GNUNET_CONTAINER_DLL_remove (h->control_head, h->control_tail, th);
+ GNUNET_CONTAINER_DLL_remove (h->control_head,
+ h->control_tail,
+ th);
nret = th->notify (th->notify_cls, size, &cbuf[ret]);
LOG (GNUNET_ERROR_TYPE_DEBUG,
"Added %u bytes of control message at %u\n",
- nret, ret);
+ nret,
+ ret);
GNUNET_free (th);
ret += nret;
size -= nret;
@@ -1093,13 +1092,11 @@ send_start (void *cls, size_t size, void *buf)
{
/* Can only be shutdown, just give up */
LOG (GNUNET_ERROR_TYPE_DEBUG,
- "Shutdown while trying to transmit `%s' request.\n",
- "START");
+ "Shutdown while trying to transmit START request.\n");
return 0;
}
LOG (GNUNET_ERROR_TYPE_DEBUG,
- "Transmitting `%s' request.\n",
- "START");
+ "Transmitting START request.\n");
GNUNET_assert (size >= sizeof (struct StartMessage));
s.header.size = htons (sizeof (struct StartMessage));
s.header.type = htons (GNUNET_MESSAGE_TYPE_TRANSPORT_START);