aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSchanzenbach, Martin <martin.schanzenbach@aisec.fraunhofer.de>2018-06-24 14:07:16 +0200
committerSchanzenbach, Martin <martin.schanzenbach@aisec.fraunhofer.de>2018-06-24 14:07:16 +0200
commit0a7a4ba1c5fbc42cc665ae3f0a2a4ebd2290286a (patch)
tree9b2f5b29d33b5a92370b28c749980a43dc0e37db /src
parent730a1a1fa6a02e48e37b19451703fe8ec5121135 (diff)
downloadgnunet-0a7a4ba1c5fbc42cc665ae3f0a2a4ebd2290286a.tar.gz
gnunet-0a7a4ba1c5fbc42cc665ae3f0a2a4ebd2290286a.zip
fix fcfsd
Diffstat (limited to 'src')
-rw-r--r--src/namestore/gnunet-namestore-fcfsd.c24
1 files changed, 18 insertions, 6 deletions
diff --git a/src/namestore/gnunet-namestore-fcfsd.c b/src/namestore/gnunet-namestore-fcfsd.c
index ddd719e73..0853ff4d7 100644
--- a/src/namestore/gnunet-namestore-fcfsd.c
+++ b/src/namestore/gnunet-namestore-fcfsd.c
@@ -117,7 +117,11 @@ struct Request
117 * a POST request). 117 * a POST request).
118 */ 118 */
119 struct MHD_PostProcessor *pp; 119 struct MHD_PostProcessor *pp;
120 120
121 /**
122 * MHD Connection
123 */
124 struct MHD_Connection *con;
121 /** 125 /**
122 * URL to serve in response to this POST (if this request 126 * URL to serve in response to this POST (if this request
123 * was a 'POST') 127 * was a 'POST')
@@ -574,6 +578,7 @@ put_continuation (void *cls,
574 } 578 }
575 else 579 else
576 request->phase = RP_SUCCESS; 580 request->phase = RP_SUCCESS;
581 MHD_resume_connection (request->con);
577 run_httpd_now (); 582 run_httpd_now ();
578} 583}
579 584
@@ -589,6 +594,7 @@ zone_to_name_error (void *cls)
589 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 594 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
590 _("Error when mapping zone to name\n")); 595 _("Error when mapping zone to name\n"));
591 request->phase = RP_FAIL; 596 request->phase = RP_FAIL;
597 MHD_resume_connection (request->con);
592 run_httpd_now (); 598 run_httpd_now ();
593} 599}
594 600
@@ -621,6 +627,7 @@ zone_to_name_cb (void *cls,
621 _("Found existing name `%s' for the given key\n"), 627 _("Found existing name `%s' for the given key\n"),
622 name); 628 name);
623 request->phase = RP_FAIL; 629 request->phase = RP_FAIL;
630 MHD_resume_connection (request->con);
624 run_httpd_now (); 631 run_httpd_now ();
625 return; 632 return;
626 } 633 }
@@ -645,7 +652,7 @@ static void
645lookup_it_error (void *cls) 652lookup_it_error (void *cls)
646{ 653{
647 struct Request *request = cls; 654 struct Request *request = cls;
648 655 MHD_resume_connection (request->con);
649 request->qe = NULL; 656 request->qe = NULL;
650 request->phase = RP_FAIL; 657 request->phase = RP_FAIL;
651 run_httpd_now (); 658 run_httpd_now ();
@@ -674,7 +681,6 @@ lookup_it_processor (void *cls,
674 (void) label; 681 (void) label;
675 (void) rd; 682 (void) rd;
676 (void) zonekey; 683 (void) zonekey;
677 request->qe = NULL;
678 if (0 == strcmp (label, request->domain_name)) { 684 if (0 == strcmp (label, request->domain_name)) {
679 GNUNET_break (0 != rd_count); 685 GNUNET_break (0 != rd_count);
680 GNUNET_log (GNUNET_ERROR_TYPE_INFO, 686 GNUNET_log (GNUNET_ERROR_TYPE_INFO,
@@ -683,14 +689,17 @@ lookup_it_processor (void *cls,
683 request->domain_name); 689 request->domain_name);
684 request->phase = RP_FAIL; 690 request->phase = RP_FAIL;
685 } 691 }
692 GNUNET_NAMESTORE_zone_iterator_next (request->lookup_it, 1);
686} 693}
687 694
688static void 695static void
689lookup_it_finished (void *cls) 696lookup_it_finished (void *cls)
690{ 697{
691 struct Request *request = cls; 698 struct Request *request = cls;
692 699
693 if (RP_FAIL == request->phase) { 700 if (RP_FAIL == request->phase)
701 {
702 MHD_resume_connection (request->con);
694 run_httpd_now (); 703 run_httpd_now ();
695 return; 704 return;
696 } 705 }
@@ -701,6 +710,7 @@ lookup_it_finished (void *cls)
701 { 710 {
702 GNUNET_break (0); 711 GNUNET_break (0);
703 request->phase = RP_FAIL; 712 request->phase = RP_FAIL;
713 MHD_resume_connection (request->con);
704 run_httpd_now (); 714 run_httpd_now ();
705 return; 715 return;
706 } 716 }
@@ -772,6 +782,7 @@ create_response (void *cls,
772 if (NULL == request) 782 if (NULL == request)
773 { 783 {
774 request = GNUNET_new (struct Request); 784 request = GNUNET_new (struct Request);
785 request->con = connection;
775 *ptr = request; 786 *ptr = request;
776 request->pp = MHD_create_post_processor (connection, 787 request->pp = MHD_create_post_processor (connection,
777 1024, 788 1024,
@@ -831,6 +842,7 @@ create_response (void *cls,
831 request, connection); 842 request, connection);
832 } 843 }
833 request->phase = RP_LOOKUP; 844 request->phase = RP_LOOKUP;
845 MHD_suspend_connection (request->con);
834 request->lookup_it 846 request->lookup_it
835 = GNUNET_NAMESTORE_zone_iteration_start (ns, 847 = GNUNET_NAMESTORE_zone_iteration_start (ns,
836 &fcfs_zone_pkey, 848 &fcfs_zone_pkey,
@@ -1060,7 +1072,7 @@ identity_cb (void *cls,
1060 } 1072 }
1061 fcfs_zone_pkey = *GNUNET_IDENTITY_ego_get_private_key (ego); 1073 fcfs_zone_pkey = *GNUNET_IDENTITY_ego_get_private_key (ego);
1062 1074
1063 options = MHD_USE_DUAL_STACK | MHD_USE_DEBUG; 1075 options = MHD_USE_DUAL_STACK | MHD_USE_DEBUG | MHD_ALLOW_SUSPEND_RESUME;
1064 do 1076 do
1065 { 1077 {
1066 httpd = MHD_start_daemon (options, 1078 httpd = MHD_start_daemon (options,