psyc/social: local join flag; social service: leave place, save _file
[oweals/gnunet.git] / src / peerstore / gnunet-peerstore.c
index 9b26cf36c40da05ab2bbfb506f35bc636f94b86e..e274a1751c221d93a8556f23b859440affa28c06 100644 (file)
@@ -1,6 +1,6 @@
 /*
      This file is part of GNUnet.
-     (C)
+     Copyright (C)
 
      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.
 */
 
 /**
 
 static int ret;
 
-/**
- * option '-t'
- */
-static int test;
-
 /*
  * Handle to PEERSTORE service
  */
@@ -46,26 +41,15 @@ struct GNUNET_PEERSTORE_Handle *peerstore_handle;
  * @param tc scheduler context
  */
 static void
-shutdown_task (void *cls,
-         const struct GNUNET_SCHEDULER_TaskContext *tc)
+shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
 {
-  if(NULL != peerstore_handle)
+  if (NULL != peerstore_handle)
   {
-    GNUNET_PEERSTORE_disconnect(peerstore_handle);
+    GNUNET_PEERSTORE_disconnect (peerstore_handle, GNUNET_YES);
     peerstore_handle = NULL;
   }
 }
 
-void test_cont(void *cls, const char *emsg)
-{
-  char *req = cls;
-
-  printf("Received a response to request: %s\n", req);
-  if(NULL != emsg)
-  {
-    printf("Response: %s\n", emsg);
-  }
-}
 
 /**
  * Main function that will be run by the scheduler.
@@ -76,43 +60,20 @@ void test_cont(void *cls, const char *emsg)
  * @param cfg configuration
  */
 static void
-run (void *cls,
-     char *const *args,
-     const char *cfgfile,
+run (void *cls, char *const *args, const char *cfgfile,
      const struct GNUNET_CONFIGURATION_Handle *cfg)
 {
 
   peerstore_handle = NULL;
-  GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL,
-                                  &shutdown_task,
-                                  NULL);
-  peerstore_handle = GNUNET_PEERSTORE_connect(cfg);
-  GNUNET_assert(NULL != peerstore_handle);
-  if(GNUNET_YES == test)
-  {
-    struct GNUNET_PeerIdentity pid;
-    memset (&pid, 32, sizeof (pid));
-    GNUNET_PEERSTORE_store(peerstore_handle,
-        &pid,
-        "subsub",
-        "value",
-        5,
-        GNUNET_TIME_UNIT_FOREVER_REL,
-        &test_cont,
-        "Req1");
-    GNUNET_PEERSTORE_store(peerstore_handle,
-            &pid,
-            "subsub",
-            "value",
-            5,
-            GNUNET_TIME_UNIT_FOREVER_REL,
-            &test_cont,
-            "Req2");
-  }
+  GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL, &shutdown_task,
+                                NULL);
+  peerstore_handle = GNUNET_PEERSTORE_connect (cfg);
+  GNUNET_assert (NULL != peerstore_handle);
 
   ret = 0;
 }
 
+
 /**
  * The main function to peerstore.
  *
@@ -124,18 +85,12 @@ int
 main (int argc, char *const *argv)
 {
   static const struct GNUNET_GETOPT_CommandLineOption options[] = {
-    {'t', "test", NULL,
-        gettext_noop("TESTING"),
-    0, &GNUNET_GETOPT_set_one, &test},
     GNUNET_GETOPT_OPTION_END
   };
   return (GNUNET_OK ==
-          GNUNET_PROGRAM_run (argc,
-                              argv,
-                              "gnunet-peerstore [options [value]]",
-                              gettext_noop
-                              ("peerstore"),
-                              options, &run, NULL)) ? ret : 1;
+          GNUNET_PROGRAM_run (argc, argv, "gnunet-peerstore [options [value]]",
+                              gettext_noop ("peerstore"), options, &run,
+                              NULL)) ? ret : 1;
 }
 
 /* end of gnunet-peerstore.c */