log: add \n
[oweals/gnunet.git] / src / regex / gnunet-service-regex.c
index 2e0700c0a0c0abe38ad2e9db7d79785623e5dcbd..294670be658c8e66175430860781e82085602336 100644 (file)
@@ -1,6 +1,6 @@
 /*
      This file is part of GNUnet.
-     Copyright (C) 2013 Christian Grothoff (and other contributing authors)
+     Copyright (C) 2013 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
@@ -14,8 +14,8 @@
 
      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.
 */
 
 /**
@@ -152,11 +152,9 @@ handle_client_disconnect (void *cls,
  * Task run during shutdown.
  *
  * @param cls unused
- * @param tc unused
  */
 static void
-cleanup_task (void *cls,
-              const struct GNUNET_SCHEDULER_TaskContext *tc)
+cleanup_task (void *cls)
 {
   struct ClientEntry *ce;
 
@@ -177,13 +175,11 @@ cleanup_task (void *cls,
 /**
  * Periodic task to refresh our announcement of the regex.
  *
- * @param cls the 'struct ClientEntry' of the client that triggered the
+ * @param cls the `struct ClientEntry *` of the client that triggered the
  *        announcement
- * @param tc scheduler context
  */
 static void
-reannounce (void *cls,
-           const struct GNUNET_SCHEDULER_TaskContext *tc)
+reannounce (void *cls)
 {
   struct ClientEntry *ce = cls;
 
@@ -292,10 +288,10 @@ handle_search_result (void *cls,
   result->put_path_length = htons ((uint16_t) put_path_length);
   result->id = *id;
   gp = &result->id;
-  memcpy (&gp[1],
+  GNUNET_memcpy (&gp[1],
          get_path,
          get_path_length * sizeof (struct GNUNET_PeerIdentity));
-  memcpy (&gp[1 + get_path_length],
+  GNUNET_memcpy (&gp[1 + get_path_length],
          put_path,
          put_path_length * sizeof (struct GNUNET_PeerIdentity));
   GNUNET_SERVER_notification_context_unicast (nc,
@@ -332,13 +328,16 @@ handle_search (void *cls,
     GNUNET_SERVER_receive_done (client, GNUNET_SYSERR);
     return;
   }
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+             "Starting to search for `%s'\n",
+             string);
   ce = GNUNET_new (struct ClientEntry);
   ce->client = client;
   ce->sh = REGEX_INTERNAL_search (dht,
-                               string,
-                               &handle_search_result,
-                               ce,
-                               stats);
+                                  string,
+                                  &handle_search_result,
+                                  ce,
+                                  stats);
   if (NULL == ce->sh)
   {
     GNUNET_break (0);
@@ -385,9 +384,8 @@ run (void *cls, struct GNUNET_SERVER_Handle *server,
     GNUNET_SCHEDULER_shutdown ();
     return;
   }
-  GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL,
-                                &cleanup_task,
-                                NULL);
+  GNUNET_SCHEDULER_add_shutdown (&cleanup_task,
+                                NULL);
   nc = GNUNET_SERVER_notification_context_create (server, 1);
   stats = GNUNET_STATISTICS_create ("regex", cfg);
   GNUNET_SERVER_add_handlers (server, handlers);