REST/NAMESTORE: rework API
[oweals/gnunet.git] / src / transport / gnunet-service-transport.c
index d3d2a86a344bb5f64f16bae4466bcab797f69640..e1dfbae0f3c57a42337fde02c22cc1bef3b6a2e9 100644 (file)
@@ -113,7 +113,12 @@ enum ClientType
   /**
    * It is a blacklist, query about allowed connections.
    */
-  CT_BLACKLIST = 3
+  CT_BLACKLIST = 3,
+
+  /**
+   * CORE client without any handlers.
+   */
+  CT_CORE_NO_HANDLERS = 4
 };
 
 
@@ -444,8 +449,8 @@ unicast (struct TransportClient *tc,
                 GNUNET_MQ_get_length (tc->mq),
                 MAX_PENDING);
     GNUNET_STATISTICS_update (GST_stats,
-                              gettext_noop
-                              ("# messages dropped due to slow client"), 1,
+                              gettext_noop ("# messages dropped due to slow client"),
+                              1,
                               GNUNET_NO);
     return;
   }
@@ -570,6 +575,8 @@ client_disconnect_cb (void *cls,
                                             bc);
     }
     break;
+  case CT_CORE_NO_HANDLERS:
+    break;
   }
   GNUNET_free (tc);
 }
@@ -650,6 +657,8 @@ handle_client_start (void *cls,
   }
   if (0 != (2 & options))
     tc->type = CT_CORE;
+  else
+    tc->type = CT_CORE_NO_HANDLERS;
   hello = GST_hello_get ();
   if (NULL != hello)
     unicast (tc,
@@ -1341,7 +1350,6 @@ void
 GST_clients_broadcast (const struct GNUNET_MessageHeader *msg,
                        int may_drop)
 {
-  struct TransportClient *tc;
   int done;
 
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
@@ -1349,8 +1357,12 @@ GST_clients_broadcast (const struct GNUNET_MessageHeader *msg,
               (unsigned int) ntohs (msg->type),
               (unsigned int) ntohs (msg->size));
   done = GNUNET_NO;
-  for (tc = clients_head; NULL != tc; tc = tc->next)
+  for (struct TransportClient *tc = clients_head;
+       NULL != tc;
+       tc = tc->next)
   {
+    if (CT_NONE == tc->type)
+      continue; /* client not yet ready */
     if ( (GNUNET_YES == may_drop) &&
          (CT_CORE != tc->type) )
       continue; /* skip, this client does not care about payload */
@@ -1382,13 +1394,14 @@ GST_clients_broadcast_peer_notification (const struct GNUNET_PeerIdentity *peer,
 {
   struct GNUNET_MQ_Envelope *env;
   struct PeerIterateResponseMessage *msg;
-  struct TransportClient *tc;
 
   msg = compose_address_iterate_response_message (peer,
                                                  address);
   msg->state = htonl (state);
   msg->state_timeout = GNUNET_TIME_absolute_hton (state_timeout);
-  for (tc = clients_head; NULL != tc; tc = tc->next)
+  for (struct TransportClient *tc = clients_head;
+       NULL != tc;
+       tc = tc->next)
   {
     if (CT_MONITOR != tc->type)
       continue;