add first sketch of gns benchmarking tool
[oweals/gnunet.git] / src / gns / plugin_rest_gns.c
index 5d4734d9a89c0c7243d437c755d0e327090c75fc..1d215b6a495bf81adef75d4d82ec4953e3b0083e 100644 (file)
@@ -423,7 +423,8 @@ identity_master_cb (void *cls,
     GNUNET_SCHEDULER_add_now (&do_error, handle);
     return;
   }
-  GNUNET_IDENTITY_ego_get_public_key (ego, &handle->pkey);
+  GNUNET_IDENTITY_ego_get_public_key (ego,
+                                      &handle->pkey);
   /* main name is our own master zone, do no look for that in the DHT */
   handle->options = GNUNET_GNS_LO_LOCAL_MASTER;
   /* if the name is of the form 'label.gnu', never go to the DHT */
@@ -465,6 +466,7 @@ parse_url (const char *url, struct LookupHandle *handle)
   return GNUNET_OK;
 }
 
+
 static void
 get_gns_cont (struct GNUNET_REST_RequestHandle *conndata_handle,
               const char* url,
@@ -529,6 +531,7 @@ get_gns_cont (struct GNUNET_REST_RequestHandle *conndata_handle,
   {
     handle->pkey_str = GNUNET_CONTAINER_multihashmap_get (conndata_handle->url_param_map,
                                                           &key);
+    GNUNET_assert (NULL != handle->pkey_str);
     if (GNUNET_OK !=
         GNUNET_CRYPTO_ecdsa_public_key_from_string (handle->pkey_str,
                                                     strlen(handle->pkey_str),
@@ -609,14 +612,19 @@ options_cont (struct GNUNET_REST_RequestHandle *con_handle,
  * @param data body of the HTTP request (optional)
  * @param data_size length of the body
  * @param proc callback function for the result
- * @param proc_cls closure for callback function
- * @return GNUNET_OK if request accepted
+ * @param proc_cls closure for @a proc
+ * @return #GNUNET_OK if request accepted
  */
 static void
-rest_gns_process_request(struct GNUNET_REST_RequestHandle *conndata_handle,
-                         GNUNET_REST_ResultProcessor proc,
-                         void *proc_cls)
+rest_gns_process_request (struct GNUNET_REST_RequestHandle *conndata_handle,
+                          GNUNET_REST_ResultProcessor proc,
+                          void *proc_cls)
 {
+  static const struct GNUNET_REST_RequestHandler handlers[] = {
+    {MHD_HTTP_METHOD_GET, GNUNET_REST_API_NS_GNS, &get_gns_cont},
+    {MHD_HTTP_METHOD_OPTIONS, GNUNET_REST_API_NS_GNS, &options_cont},
+    GNUNET_REST_HANDLER_END
+  };
   struct LookupHandle *handle = GNUNET_new (struct LookupHandle);
   struct GNUNET_REST_RequestHandlerError err;
 
@@ -625,12 +633,6 @@ rest_gns_process_request(struct GNUNET_REST_RequestHandle *conndata_handle,
   handle->proc = proc;
   handle->rest_handle = conndata_handle;
 
-  static const struct GNUNET_REST_RequestHandler handlers[] = {
-    {MHD_HTTP_METHOD_GET, GNUNET_REST_API_NS_GNS, &get_gns_cont},
-    {MHD_HTTP_METHOD_OPTIONS, GNUNET_REST_API_NS_GNS, &options_cont},
-    GNUNET_REST_HANDLER_END
-  };
-
   if (GNUNET_NO == GNUNET_JSONAPI_handle_request (conndata_handle,
                                                   handlers,
                                                   &err,