convert fs publish to MQ
[oweals/gnunet.git] / src / core / gnunet-service-core_clients.c
index b5e3f471386971d8961640b0ffc527d57e01114c..c2198848fea452ac4d67f65e7895cd8902bf0453 100644 (file)
@@ -1,6 +1,6 @@
 /*
      This file is part of GNUnet.
-     Copyright (C) 2009, 2010, 2011 Christian Grothoff (and other contributing authors)
+     Copyright (C) 2009, 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
@@ -199,8 +199,9 @@ type_match (uint16_t type, struct GSC_Client *c)
 {
   unsigned int i;
 
-  if (c->tcnt == 0)
-    return GNUNET_YES;          /* peer without handlers matches ALL */
+  if (c->tcnt == 0 && c->options != 0)
+    return GNUNET_YES;          /* peer without handlers and inbound/outbond
+                                  callbacks matches ALL */
   for (i = 0; i < c->tcnt; i++)
     if (type == c->types[i])
       return GNUNET_YES;
@@ -400,7 +401,14 @@ handle_client_send_request (void *cls,
   {
     /* dequeue and recycle memory from pending request, there can only
        be at most one per client and peer */
+    GNUNET_STATISTICS_update (GSC_stats,
+                              gettext_noop
+                              ("# dequeuing CAR (duplicate request)"), 1,
+                              GNUNET_NO);
     GSC_SESSIONS_dequeue_request (car);
+    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+                "Transmission request to `%s' was a duplicate!\n",
+                GNUNET_i2s (&req->peer));
   }
   car->target = req->peer;
   car->received_time = GNUNET_TIME_absolute_get ();
@@ -506,22 +514,20 @@ handle_client_send (void *cls,
   tc.priority = (enum GNUNET_CORE_Priority) ntohl (sm->priority);
   if (overdue.rel_value_us > GNUNET_CONSTANTS_LATENCY_WARN.rel_value_us)
     GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
-                "Client waited %s for transmission of %u bytes to `%s'%s, CORE queue is %u entries\n",
+                "Client waited %s for transmission of %u bytes to `%s'%s\n",
                 GNUNET_STRINGS_relative_time_to_string (delay,
                                                         GNUNET_YES),
                 msize,
                 GNUNET_i2s (&sm->peer),
-                tc.cork ? "" : " (corked)",
-                GSC_NEIGHBOURS_get_queue_size (&sm->peer));
+                tc.cork ? "" : " (corked)");
   else
     GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                "Client waited %s for transmission of %u bytes to `%s'%s, CORE queue is %u entries\n",
+                "Client waited %s for transmission of %u bytes to `%s'%s\n",
                 GNUNET_STRINGS_relative_time_to_string (delay,
                                                         GNUNET_YES),
                 msize,
                 GNUNET_i2s (&sm->peer),
-                tc.cork ? "" : " (corked)",
-                GSC_NEIGHBOURS_get_queue_size (&sm->peer));
+                tc.cork ? "" : " (corked)");
 
   GNUNET_assert (GNUNET_YES ==
                  GNUNET_CONTAINER_multipeermap_remove (c->requests,
@@ -877,7 +883,7 @@ GSC_CLIENTS_deliver_message (const struct GNUNET_PeerIdentity *sender,
          (0 != (options & GNUNET_CORE_OPTION_SEND_FULL_INBOUND)) ))
     return; /* no client cares about this message notification */
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-              "Core service passes message from `%4s' of type %u to client.\n",
+              "Core service passes message from `%s' of type %u to client.\n",
               GNUNET_i2s (sender),
               (unsigned int) ntohs (msg->type));
   GSC_SESSIONS_add_to_typemap (sender, ntohs (msg->type));