diff options
author | Christian Grothoff <christian@grothoff.org> | 2018-04-10 13:02:28 +0200 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2018-04-10 13:02:51 +0200 |
commit | 0cd0e3a5287af73bb81219ebc9548395a8945ce8 (patch) | |
tree | b5bb24d78a4eed519b37e6fb8f9291a6282d06d4 /src/namestore/gnunet-namestore-fcfsd.c | |
parent | 3eae3e43d6f94449cb89998a676e6696438cc604 (diff) | |
download | gnunet-0cd0e3a5287af73bb81219ebc9548395a8945ce8.tar.gz gnunet-0cd0e3a5287af73bb81219ebc9548395a8945ce8.zip |
more work on gnunet-zoneimport, some bugfix in flat namestore, misc. style fixes
Diffstat (limited to 'src/namestore/gnunet-namestore-fcfsd.c')
-rw-r--r-- | src/namestore/gnunet-namestore-fcfsd.c | 93 |
1 files changed, 68 insertions, 25 deletions
diff --git a/src/namestore/gnunet-namestore-fcfsd.c b/src/namestore/gnunet-namestore-fcfsd.c index b38761d5a..ddd609918 100644 --- a/src/namestore/gnunet-namestore-fcfsd.c +++ b/src/namestore/gnunet-namestore-fcfsd.c | |||
@@ -480,10 +480,16 @@ post_iterator (void *cls, | |||
480 | const char *filename, | 480 | const char *filename, |
481 | const char *content_type, | 481 | const char *content_type, |
482 | const char *transfer_encoding, | 482 | const char *transfer_encoding, |
483 | const char *data, uint64_t off, size_t size) | 483 | const char *data, |
484 | uint64_t off, | ||
485 | size_t size) | ||
484 | { | 486 | { |
485 | struct Request *request = cls; | 487 | struct Request *request = cls; |
486 | 488 | ||
489 | (void) kind; | ||
490 | (void) filename; | ||
491 | (void) content_type; | ||
492 | (void) transfer_encoding; | ||
487 | if (0 == strcmp ("domain", key)) | 493 | if (0 == strcmp ("domain", key)) |
488 | { | 494 | { |
489 | if (size + off >= sizeof(request->domain_name)) | 495 | if (size + off >= sizeof(request->domain_name)) |
@@ -578,7 +584,6 @@ zone_to_name_cb (void *cls, | |||
578 | struct GNUNET_GNSRECORD_Data r; | 584 | struct GNUNET_GNSRECORD_Data r; |
579 | 585 | ||
580 | request->qe = NULL; | 586 | request->qe = NULL; |
581 | |||
582 | if (0 != rd_count) | 587 | if (0 != rd_count) |
583 | { | 588 | { |
584 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | 589 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, |
@@ -726,8 +731,10 @@ create_response (void *cls, | |||
726 | { | 731 | { |
727 | request = GNUNET_new (struct Request); | 732 | request = GNUNET_new (struct Request); |
728 | *ptr = request; | 733 | *ptr = request; |
729 | request->pp = MHD_create_post_processor (connection, 1024, | 734 | request->pp = MHD_create_post_processor (connection, |
730 | &post_iterator, request); | 735 | 1024, |
736 | &post_iterator, | ||
737 | request); | ||
731 | if (NULL == request->pp) | 738 | if (NULL == request->pp) |
732 | { | 739 | { |
733 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 740 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
@@ -770,7 +777,8 @@ create_response (void *cls, | |||
770 | _("Domain name must not contain `.'\n")); | 777 | _("Domain name must not contain `.'\n")); |
771 | request->phase = RP_FAIL; | 778 | request->phase = RP_FAIL; |
772 | return fill_s_reply ("Domain name must not contain `.', sorry.", | 779 | return fill_s_reply ("Domain name must not contain `.', sorry.", |
773 | request, connection); | 780 | request, |
781 | connection); | ||
774 | } | 782 | } |
775 | if (NULL != strchr (request->domain_name, (int) '+')) | 783 | if (NULL != strchr (request->domain_name, (int) '+')) |
776 | { | 784 | { |
@@ -781,13 +789,14 @@ create_response (void *cls, | |||
781 | request, connection); | 789 | request, connection); |
782 | } | 790 | } |
783 | request->phase = RP_LOOKUP; | 791 | request->phase = RP_LOOKUP; |
784 | request->qe = GNUNET_NAMESTORE_records_lookup (ns, | 792 | request->qe |
785 | &fcfs_zone_pkey, | 793 | = GNUNET_NAMESTORE_records_lookup (ns, |
786 | request->domain_name, | 794 | &fcfs_zone_pkey, |
787 | &lookup_block_error, | 795 | request->domain_name, |
788 | request, | 796 | &lookup_block_error, |
789 | &lookup_block_processor, | 797 | request, |
790 | request); | 798 | &lookup_block_processor, |
799 | request); | ||
791 | break; | 800 | break; |
792 | case RP_LOOKUP: | 801 | case RP_LOOKUP: |
793 | break; | 802 | break; |
@@ -834,6 +843,9 @@ request_completed_callback (void *cls, | |||
834 | { | 843 | { |
835 | struct Request *request = *con_cls; | 844 | struct Request *request = *con_cls; |
836 | 845 | ||
846 | (void) cls; | ||
847 | (void) connection; | ||
848 | (void) toe; | ||
837 | if (NULL == request) | 849 | if (NULL == request) |
838 | return; | 850 | return; |
839 | if (NULL != request->pp) | 851 | if (NULL != request->pp) |
@@ -871,19 +883,34 @@ run_httpd () | |||
871 | wes = GNUNET_NETWORK_fdset_create (); | 883 | wes = GNUNET_NETWORK_fdset_create (); |
872 | wws = GNUNET_NETWORK_fdset_create (); | 884 | wws = GNUNET_NETWORK_fdset_create (); |
873 | max = -1; | 885 | max = -1; |
874 | GNUNET_assert (MHD_YES == MHD_get_fdset (httpd, &rs, &ws, &es, &max)); | 886 | GNUNET_assert (MHD_YES == |
875 | haveto = MHD_get_timeout (httpd, &timeout); | 887 | MHD_get_fdset (httpd, |
888 | &rs, | ||
889 | &ws, | ||
890 | &es, | ||
891 | &max)); | ||
892 | haveto = MHD_get_timeout (httpd, | ||
893 | &timeout); | ||
876 | if (haveto == MHD_YES) | 894 | if (haveto == MHD_YES) |
877 | tv.rel_value_us = (uint64_t) timeout * 1000LL; | 895 | tv.rel_value_us = (uint64_t) timeout * 1000LL; |
878 | else | 896 | else |
879 | tv = GNUNET_TIME_UNIT_FOREVER_REL; | 897 | tv = GNUNET_TIME_UNIT_FOREVER_REL; |
880 | GNUNET_NETWORK_fdset_copy_native (wrs, &rs, max + 1); | 898 | GNUNET_NETWORK_fdset_copy_native (wrs, |
881 | GNUNET_NETWORK_fdset_copy_native (wws, &ws, max + 1); | 899 | &rs, |
882 | GNUNET_NETWORK_fdset_copy_native (wes, &es, max + 1); | 900 | max + 1); |
901 | GNUNET_NETWORK_fdset_copy_native (wws, | ||
902 | &ws, | ||
903 | max + 1); | ||
904 | GNUNET_NETWORK_fdset_copy_native (wes, | ||
905 | &es, | ||
906 | max + 1); | ||
883 | httpd_task = | 907 | httpd_task = |
884 | GNUNET_SCHEDULER_add_select (GNUNET_SCHEDULER_PRIORITY_HIGH, | 908 | GNUNET_SCHEDULER_add_select (GNUNET_SCHEDULER_PRIORITY_HIGH, |
885 | tv, wrs, wws, | 909 | tv, |
886 | &do_httpd, NULL); | 910 | wrs, |
911 | wws, | ||
912 | &do_httpd, | ||
913 | NULL); | ||
887 | GNUNET_NETWORK_fdset_destroy (wrs); | 914 | GNUNET_NETWORK_fdset_destroy (wrs); |
888 | GNUNET_NETWORK_fdset_destroy (wws); | 915 | GNUNET_NETWORK_fdset_destroy (wws); |
889 | GNUNET_NETWORK_fdset_destroy (wes); | 916 | GNUNET_NETWORK_fdset_destroy (wes); |
@@ -898,6 +925,7 @@ run_httpd () | |||
898 | static void | 925 | static void |
899 | do_httpd (void *cls) | 926 | do_httpd (void *cls) |
900 | { | 927 | { |
928 | (void) cls; | ||
901 | httpd_task = NULL; | 929 | httpd_task = NULL; |
902 | MHD_run (httpd); | 930 | MHD_run (httpd); |
903 | run_httpd (); | 931 | run_httpd (); |
@@ -912,6 +940,7 @@ do_httpd (void *cls) | |||
912 | static void | 940 | static void |
913 | do_shutdown (void *cls) | 941 | do_shutdown (void *cls) |
914 | { | 942 | { |
943 | (void) cls; | ||
915 | if (NULL != httpd_task) | 944 | if (NULL != httpd_task) |
916 | { | 945 | { |
917 | GNUNET_SCHEDULER_cancel (httpd_task); | 946 | GNUNET_SCHEDULER_cancel (httpd_task); |
@@ -967,6 +996,9 @@ identity_cb (void *cls, | |||
967 | { | 996 | { |
968 | int options; | 997 | int options; |
969 | 998 | ||
999 | (void) cls; | ||
1000 | (void) ctx; | ||
1001 | (void) name; | ||
970 | id_op = NULL; | 1002 | id_op = NULL; |
971 | if (NULL == ego) | 1003 | if (NULL == ego) |
972 | { | 1004 | { |
@@ -1014,9 +1046,14 @@ identity_cb (void *cls, | |||
1014 | * @param cfg configuration | 1046 | * @param cfg configuration |
1015 | */ | 1047 | */ |
1016 | static void | 1048 | static void |
1017 | run (void *cls, char *const *args, const char *cfgfile, | 1049 | run (void *cls, |
1050 | char *const *args, | ||
1051 | const char *cfgfile, | ||
1018 | const struct GNUNET_CONFIGURATION_Handle *cfg) | 1052 | const struct GNUNET_CONFIGURATION_Handle *cfg) |
1019 | { | 1053 | { |
1054 | (void) cls; | ||
1055 | (void) args; | ||
1056 | (void) cfgfile; | ||
1020 | if (GNUNET_OK != | 1057 | if (GNUNET_OK != |
1021 | GNUNET_CONFIGURATION_get_value_number (cfg, | 1058 | GNUNET_CONFIGURATION_get_value_number (cfg, |
1022 | "fcfsd", | 1059 | "fcfsd", |
@@ -1056,21 +1093,27 @@ run (void *cls, char *const *args, const char *cfgfile, | |||
1056 | * @return 0 ok, 1 on error | 1093 | * @return 0 ok, 1 on error |
1057 | */ | 1094 | */ |
1058 | int | 1095 | int |
1059 | main (int argc, char *const *argv) | 1096 | main (int argc, |
1097 | char *const *argv) | ||
1060 | { | 1098 | { |
1061 | static const struct GNUNET_GETOPT_CommandLineOption options[] = { | 1099 | static const struct GNUNET_GETOPT_CommandLineOption options[] = { |
1062 | GNUNET_GETOPT_OPTION_END | 1100 | GNUNET_GETOPT_OPTION_END |
1063 | }; | 1101 | }; |
1064 | |||
1065 | int ret; | 1102 | int ret; |
1066 | 1103 | ||
1067 | if (GNUNET_OK != GNUNET_STRINGS_get_utf8_args (argc, argv, &argc, &argv)) | 1104 | if (GNUNET_OK != |
1105 | GNUNET_STRINGS_get_utf8_args (argc, argv, | ||
1106 | &argc, &argv)) | ||
1068 | return 2; | 1107 | return 2; |
1069 | 1108 | ||
1070 | GNUNET_log_setup ("fcfsd", "WARNING", NULL); | 1109 | GNUNET_log_setup ("fcfsd", |
1110 | "WARNING", | ||
1111 | NULL); | ||
1071 | ret = | 1112 | ret = |
1072 | (GNUNET_OK == | 1113 | (GNUNET_OK == |
1073 | GNUNET_PROGRAM_run (argc, argv, "fcfsd", | 1114 | GNUNET_PROGRAM_run (argc, |
1115 | argv, | ||
1116 | "gnunet-namestore-fcfsd", | ||
1074 | _("GNU Name System First Come First Serve name registration service"), | 1117 | _("GNU Name System First Come First Serve name registration service"), |
1075 | options, | 1118 | options, |
1076 | &run, NULL)) ? 0 : 1; | 1119 | &run, NULL)) ? 0 : 1; |