diff options
author | Christian Grothoff <christian@grothoff.org> | 2018-03-08 15:50:18 +0100 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2018-03-08 15:50:18 +0100 |
commit | 310d0f559656343c4fd849fa517a054c31b24a4e (patch) | |
tree | 7c4d3c9a1adc9e1163a4f603e2b72cb744b877e9 /src/gns/plugin_rest_gns.c | |
parent | 0fa813ec6c9083a9b689181daccdf1d8a0228ca7 (diff) | |
download | gnunet-310d0f559656343c4fd849fa517a054c31b24a4e.tar.gz gnunet-310d0f559656343c4fd849fa517a054c31b24a4e.zip |
misc fixes to gnunet-gns-proxy, in particular avoiding MHD-busy waiting
Diffstat (limited to 'src/gns/plugin_rest_gns.c')
-rw-r--r-- | src/gns/plugin_rest_gns.c | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/src/gns/plugin_rest_gns.c b/src/gns/plugin_rest_gns.c index b7775e4ea..1d215b6a4 100644 --- a/src/gns/plugin_rest_gns.c +++ b/src/gns/plugin_rest_gns.c | |||
@@ -423,7 +423,8 @@ identity_master_cb (void *cls, | |||
423 | GNUNET_SCHEDULER_add_now (&do_error, handle); | 423 | GNUNET_SCHEDULER_add_now (&do_error, handle); |
424 | return; | 424 | return; |
425 | } | 425 | } |
426 | GNUNET_IDENTITY_ego_get_public_key (ego, &handle->pkey); | 426 | GNUNET_IDENTITY_ego_get_public_key (ego, |
427 | &handle->pkey); | ||
427 | /* main name is our own master zone, do no look for that in the DHT */ | 428 | /* main name is our own master zone, do no look for that in the DHT */ |
428 | handle->options = GNUNET_GNS_LO_LOCAL_MASTER; | 429 | handle->options = GNUNET_GNS_LO_LOCAL_MASTER; |
429 | /* if the name is of the form 'label.gnu', never go to the DHT */ | 430 | /* 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) | |||
465 | return GNUNET_OK; | 466 | return GNUNET_OK; |
466 | } | 467 | } |
467 | 468 | ||
469 | |||
468 | static void | 470 | static void |
469 | get_gns_cont (struct GNUNET_REST_RequestHandle *conndata_handle, | 471 | get_gns_cont (struct GNUNET_REST_RequestHandle *conndata_handle, |
470 | const char* url, | 472 | const char* url, |
@@ -610,14 +612,19 @@ options_cont (struct GNUNET_REST_RequestHandle *con_handle, | |||
610 | * @param data body of the HTTP request (optional) | 612 | * @param data body of the HTTP request (optional) |
611 | * @param data_size length of the body | 613 | * @param data_size length of the body |
612 | * @param proc callback function for the result | 614 | * @param proc callback function for the result |
613 | * @param proc_cls closure for callback function | 615 | * @param proc_cls closure for @a proc |
614 | * @return GNUNET_OK if request accepted | 616 | * @return #GNUNET_OK if request accepted |
615 | */ | 617 | */ |
616 | static void | 618 | static void |
617 | rest_gns_process_request(struct GNUNET_REST_RequestHandle *conndata_handle, | 619 | rest_gns_process_request (struct GNUNET_REST_RequestHandle *conndata_handle, |
618 | GNUNET_REST_ResultProcessor proc, | 620 | GNUNET_REST_ResultProcessor proc, |
619 | void *proc_cls) | 621 | void *proc_cls) |
620 | { | 622 | { |
623 | static const struct GNUNET_REST_RequestHandler handlers[] = { | ||
624 | {MHD_HTTP_METHOD_GET, GNUNET_REST_API_NS_GNS, &get_gns_cont}, | ||
625 | {MHD_HTTP_METHOD_OPTIONS, GNUNET_REST_API_NS_GNS, &options_cont}, | ||
626 | GNUNET_REST_HANDLER_END | ||
627 | }; | ||
621 | struct LookupHandle *handle = GNUNET_new (struct LookupHandle); | 628 | struct LookupHandle *handle = GNUNET_new (struct LookupHandle); |
622 | struct GNUNET_REST_RequestHandlerError err; | 629 | struct GNUNET_REST_RequestHandlerError err; |
623 | 630 | ||
@@ -626,12 +633,6 @@ rest_gns_process_request(struct GNUNET_REST_RequestHandle *conndata_handle, | |||
626 | handle->proc = proc; | 633 | handle->proc = proc; |
627 | handle->rest_handle = conndata_handle; | 634 | handle->rest_handle = conndata_handle; |
628 | 635 | ||
629 | static const struct GNUNET_REST_RequestHandler handlers[] = { | ||
630 | {MHD_HTTP_METHOD_GET, GNUNET_REST_API_NS_GNS, &get_gns_cont}, | ||
631 | {MHD_HTTP_METHOD_OPTIONS, GNUNET_REST_API_NS_GNS, &options_cont}, | ||
632 | GNUNET_REST_HANDLER_END | ||
633 | }; | ||
634 | |||
635 | if (GNUNET_NO == GNUNET_JSONAPI_handle_request (conndata_handle, | 636 | if (GNUNET_NO == GNUNET_JSONAPI_handle_request (conndata_handle, |
636 | handlers, | 637 | handlers, |
637 | &err, | 638 | &err, |