better
authorChristian Grothoff <christian@grothoff.org>
Wed, 24 Mar 2010 15:12:10 +0000 (15:12 +0000)
committerChristian Grothoff <christian@grothoff.org>
Wed, 24 Mar 2010 15:12:10 +0000 (15:12 +0000)
src/fs/fs_publish.c
src/fs/test_fs_namespace.c

index 634f88801d75eb21f7b970e13ad6d13d84531aa4..e60b07f5b998dd24f06410017fd1f6dbf1bebbe1 100644 (file)
@@ -1456,7 +1456,7 @@ GNUNET_FS_publish_sks (struct GNUNET_FS_Handle *h,
                       const char *identifier,
                       const char *update,
                       struct GNUNET_CONTAINER_MetaData *meta,
-                      struct GNUNET_FS_Uri *uri,
+                      const struct GNUNET_FS_Uri *uri,
                       struct GNUNET_TIME_Absolute expirationTime,
                       uint32_t anonymity,
                       uint32_t priority,
index 825612b1aad07ccf0dae12a851cecf61a3c972d1..0972730d2dc35d37f9ae9856b59c9e84391f2c7d 100644 (file)
@@ -109,40 +109,58 @@ publish_cont (void *cls,
   search = GNUNET_FS_search_start (fs, uri, 1, "ns-search");
 }
 
-
 static void
-testNamespace ()
+adv_cont (void *cls,
+             const struct GNUNET_FS_Uri *uri,
+             const char *emsg)
 {
-  struct GNUNET_FS_Namespace *ns;
-  struct GNUNET_FS_Uri *adv;
+  struct GNUNET_FS_SearchContext *search;
   struct GNUNET_CONTAINER_MetaData *meta;
+  struct GNUNET_FS_Namespace *ns;
   struct GNUNET_TIME_Absolute expiration;
 
   expiration = GNUNET_TIME_relative_to_absolute (GNUNET_TIME_UNIT_MINUTES);
-  meta = GNUNET_CONTAINER_meta_data_create ();
-  adv = GNUNET_FS_uri_ksk_create ("testNamespace", NULL);
   ns = GNUNET_FS_namespace_create (fs,
                                   "testNamespace");
-  GNUNET_FS_namespace_advertise (fs,
-                                ns,
-                                meta,
-                                1, 1,
-                                expiration,                                       
-                                "root",
-                                &publish_cont, NULL);
-#if 0
+  meta = GNUNET_CONTAINER_meta_data_create ();
+  GNUNET_assert (NULL == emsg);
+  fprintf (stderr, "Starting namespace search...\n");
+  search = GNUNET_FS_search_start (fs, uri, 1, "ns-search");
   GNUNET_FS_publish_sks (fs,
                         ns,
                         "this",
                         "next",
                         meta,
-                        rootUri,
+                        uri,
                         expiration,
                         1, 1,
                         GNUNET_FS_PUBLISH_OPTION_NONE,
                         &publish_cont,
                         NULL);
-#endif
+  GNUNET_CONTAINER_meta_data_destroy (meta);
+  GNUNET_FS_namespace_delete (ns, GNUNET_NO);
+}
+
+
+static void
+testNamespace ()
+{
+  struct GNUNET_FS_Namespace *ns;
+  struct GNUNET_TIME_Absolute expiration;
+  struct GNUNET_CONTAINER_MetaData *meta;
+
+  expiration = GNUNET_TIME_relative_to_absolute (GNUNET_TIME_UNIT_MINUTES);
+  meta = GNUNET_CONTAINER_meta_data_create ();
+  ns = GNUNET_FS_namespace_create (fs,
+                                  "testNamespace");
+  GNUNET_FS_namespace_advertise (fs,
+                                ns,
+                                meta,
+                                1, 1,
+                                expiration,                                       
+                                "root",
+                                &adv_cont, NULL);
+  GNUNET_FS_namespace_delete (ns, GNUNET_NO);
   GNUNET_CONTAINER_meta_data_destroy (meta);
 }