gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r35204 - in gnunet/src: ats transport


From: gnunet
Subject: [GNUnet-SVN] r35204 - in gnunet/src: ats transport
Date: Tue, 10 Feb 2015 01:00:56 +0100

Author: grothoff
Date: 2015-02-10 01:00:56 +0100 (Tue, 10 Feb 2015)
New Revision: 35204

Modified:
   gnunet/src/ats/ats_api_connectivity.c
   gnunet/src/ats/ats_api_performance.c
   gnunet/src/ats/ats_api_scanner.c
   gnunet/src/ats/ats_api_scheduling.c
   gnunet/src/transport/gnunet-service-transport_clients.c
   gnunet/src/transport/transport_api.c
Log:
-fix

Modified: gnunet/src/ats/ats_api_connectivity.c
===================================================================
--- gnunet/src/ats/ats_api_connectivity.c       2015-02-09 21:19:46 UTC (rev 
35203)
+++ gnunet/src/ats/ats_api_connectivity.c       2015-02-10 00:00:56 UTC (rev 
35204)
@@ -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 @@
 {
   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 @@
 {
   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 @@
   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,

Modified: gnunet/src/ats/ats_api_performance.c
===================================================================
--- gnunet/src/ats/ats_api_performance.c        2015-02-09 21:19:46 UTC (rev 
35203)
+++ gnunet/src/ats/ats_api_performance.c        2015-02-10 00:00:56 UTC (rev 
35204)
@@ -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 @@
     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 @@
        (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 @@
   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);

Modified: gnunet/src/ats/ats_api_scanner.c
===================================================================
--- gnunet/src/ats/ats_api_scanner.c    2015-02-09 21:19:46 UTC (rev 35203)
+++ gnunet/src/ats/ats_api_scanner.c    2015-02-10 00:00:56 UTC (rev 35204)
@@ -271,11 +271,12 @@
   /* 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 @@
   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),

Modified: gnunet/src/ats/ats_api_scheduling.c
===================================================================
--- gnunet/src/ats/ats_api_scheduling.c 2015-02-09 21:19:46 UTC (rev 35203)
+++ gnunet/src/ats/ats_api_scheduling.c 2015-02-10 00:00:56 UTC (rev 35204)
@@ -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 @@
     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 @@
     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 @@
 {
   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 @@
   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 @@
     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 @@
   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 @@
   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;

Modified: gnunet/src/transport/gnunet-service-transport_clients.c
===================================================================
--- gnunet/src/transport/gnunet-service-transport_clients.c     2015-02-09 
21:19:46 UTC (rev 35203)
+++ gnunet/src/transport/gnunet-service-transport_clients.c     2015-02-10 
00:00:56 UTC (rev 35204)
@@ -646,22 +646,12 @@
   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);
 }

Modified: gnunet/src/transport/transport_api.c
===================================================================
--- gnunet/src/transport/transport_api.c        2015-02-09 21:19:46 UTC (rev 
35203)
+++ gnunet/src/transport/transport_api.c        2015-02-10 00:00:56 UTC (rev 
35204)
@@ -689,8 +689,8 @@
       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 @@
     }
     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 @@
     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 @@
     }
     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 @@
       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 @@
     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 @@
   /* 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 @@
   {
     /* 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);




reply via email to

[Prev in Thread] Current Thread [Next in Thread]