aboutsummaryrefslogtreecommitdiff
path: root/src/namestore
diff options
context:
space:
mode:
Diffstat (limited to 'src/namestore')
-rw-r--r--src/namestore/gnunet-service-namestore.c4
-rw-r--r--src/namestore/namestore_api_monitor.c2
-rw-r--r--src/namestore/plugin_rest_namestore.c40
3 files changed, 37 insertions, 9 deletions
diff --git a/src/namestore/gnunet-service-namestore.c b/src/namestore/gnunet-service-namestore.c
index bb8138e23..b24bb2952 100644
--- a/src/namestore/gnunet-service-namestore.c
+++ b/src/namestore/gnunet-service-namestore.c
@@ -1809,7 +1809,7 @@ run_zone_iteration_round (struct ZoneIteration *zi, uint64_t limit)
1809 start = GNUNET_TIME_absolute_get (); 1809 start = GNUNET_TIME_absolute_get ();
1810 GNUNET_break (GNUNET_SYSERR != 1810 GNUNET_break (GNUNET_SYSERR !=
1811 GSN_database->iterate_records (GSN_database->cls, 1811 GSN_database->iterate_records (GSN_database->cls,
1812 (0 == GNUNET_is_zero (&zi->zone)) 1812 (GNUNET_YES == GNUNET_is_zero (&zi->zone))
1813 ? NULL 1813 ? NULL
1814 : &zi->zone, 1814 : &zi->zone,
1815 zi->seq, 1815 zi->seq,
@@ -2083,7 +2083,7 @@ monitor_iteration_next (void *cls)
2083 else 2083 else
2084 zm->iteration_cnt = zm->limit; /* use it all */ 2084 zm->iteration_cnt = zm->limit; /* use it all */
2085 ret = GSN_database->iterate_records (GSN_database->cls, 2085 ret = GSN_database->iterate_records (GSN_database->cls,
2086 (0 == GNUNET_is_zero (&zm->zone)) 2086 (GNUNET_YES == GNUNET_is_zero (&zm->zone))
2087 ? NULL 2087 ? NULL
2088 : &zm->zone, 2088 : &zm->zone,
2089 zm->seq, 2089 zm->seq,
diff --git a/src/namestore/namestore_api_monitor.c b/src/namestore/namestore_api_monitor.c
index ab6140328..9dc955544 100644
--- a/src/namestore/namestore_api_monitor.c
+++ b/src/namestore/namestore_api_monitor.c
@@ -139,7 +139,7 @@ check_result (void *cls, const struct RecordResultMessage *lrm)
139 139
140 (void) cls; 140 (void) cls;
141 if ((0 != GNUNET_memcmp (&lrm->private_key, &zm->zone)) && 141 if ((0 != GNUNET_memcmp (&lrm->private_key, &zm->zone)) &&
142 (0 != GNUNET_is_zero (&zm->zone))) 142 (GNUNET_NO == GNUNET_is_zero (&zm->zone)))
143 { 143 {
144 GNUNET_break (0); 144 GNUNET_break (0);
145 return GNUNET_SYSERR; 145 return GNUNET_SYSERR;
diff --git a/src/namestore/plugin_rest_namestore.c b/src/namestore/plugin_rest_namestore.c
index c993518ea..9354b9896 100644
--- a/src/namestore/plugin_rest_namestore.c
+++ b/src/namestore/plugin_rest_namestore.c
@@ -161,6 +161,16 @@ enum UpdateStrategy
161struct RequestHandle 161struct RequestHandle
162{ 162{
163 /** 163 /**
164 * DLL
165 */
166 struct RequestHandle *next;
167
168 /**
169 * DLL
170 */
171 struct RequestHandle *prev;
172
173 /**
164 * Records to store 174 * Records to store
165 */ 175 */
166 char *record_name; 176 char *record_name;
@@ -258,6 +268,17 @@ struct RequestHandle
258}; 268};
259 269
260/** 270/**
271 * DLL
272 */
273static struct RequestHandle *requests_head;
274
275/**
276 * DLL
277 */
278static struct RequestHandle *requests_tail;
279
280
281/**
261 * Cleanup lookup handle 282 * Cleanup lookup handle
262 * @param handle Handle to clean up 283 * @param handle Handle to clean up
263 */ 284 */
@@ -298,7 +319,9 @@ cleanup_handle (void *cls)
298 { 319 {
299 json_decref (handle->resp_object); 320 json_decref (handle->resp_object);
300 } 321 }
301 322 GNUNET_CONTAINER_DLL_remove (requests_head,
323 requests_tail,
324 handle);
302 GNUNET_free (handle); 325 GNUNET_free (handle);
303} 326}
304 327
@@ -329,7 +352,7 @@ do_error (void *cls)
329 handle->proc (handle->proc_cls, resp, handle->response_code); 352 handle->proc (handle->proc_cls, resp, handle->response_code);
330 json_decref (json_error); 353 json_decref (json_error);
331 GNUNET_free (response); 354 GNUNET_free (response);
332 GNUNET_SCHEDULER_add_now (&cleanup_handle, handle); 355 cleanup_handle (handle);
333} 356}
334 357
335 358
@@ -1024,10 +1047,14 @@ rest_process_request (struct GNUNET_REST_RequestHandle *rest_handle,
1024 handle->proc = proc; 1047 handle->proc = proc;
1025 handle->rest_handle = rest_handle; 1048 handle->rest_handle = rest_handle;
1026 handle->zone_pkey = NULL; 1049 handle->zone_pkey = NULL;
1027 1050 handle->timeout_task =
1051 GNUNET_SCHEDULER_add_delayed (handle->timeout, &do_error, handle);
1028 handle->url = GNUNET_strdup (rest_handle->url); 1052 handle->url = GNUNET_strdup (rest_handle->url);
1029 if (handle->url[strlen (handle->url) - 1] == '/') 1053 if (handle->url[strlen (handle->url) - 1] == '/')
1030 handle->url[strlen (handle->url) - 1] = '\0'; 1054 handle->url[strlen (handle->url) - 1] = '\0';
1055 GNUNET_CONTAINER_DLL_insert (requests_head,
1056 requests_tail,
1057 handle);
1031 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Connecting...\n"); 1058 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Connecting...\n");
1032 if (GNUNET_NO == 1059 if (GNUNET_NO ==
1033 GNUNET_REST_handle_request (handle->rest_handle, handlers, &err, handle)) 1060 GNUNET_REST_handle_request (handle->rest_handle, handlers, &err, handle))
@@ -1036,9 +1063,6 @@ rest_process_request (struct GNUNET_REST_RequestHandle *rest_handle,
1036 return GNUNET_NO; 1063 return GNUNET_NO;
1037 } 1064 }
1038 1065
1039 handle->timeout_task =
1040 GNUNET_SCHEDULER_add_delayed (handle->timeout, &do_error, handle);
1041
1042 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Connected\n"); 1066 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Connected\n");
1043 return GNUNET_YES; 1067 return GNUNET_YES;
1044} 1068}
@@ -1065,6 +1089,7 @@ libgnunet_plugin_rest_namestore_init (void *cls)
1065 api->cls = &plugin; 1089 api->cls = &plugin;
1066 api->name = GNUNET_REST_API_NS_NAMESTORE; 1090 api->name = GNUNET_REST_API_NS_NAMESTORE;
1067 api->process_request = &rest_process_request; 1091 api->process_request = &rest_process_request;
1092 state = ID_REST_STATE_INIT;
1068 GNUNET_asprintf (&allow_methods, 1093 GNUNET_asprintf (&allow_methods,
1069 "%s, %s, %s, %s, %s", 1094 "%s, %s, %s, %s, %s",
1070 MHD_HTTP_METHOD_GET, 1095 MHD_HTTP_METHOD_GET,
@@ -1091,10 +1116,13 @@ libgnunet_plugin_rest_namestore_done (void *cls)
1091{ 1116{
1092 struct GNUNET_REST_Plugin *api = cls; 1117 struct GNUNET_REST_Plugin *api = cls;
1093 struct Plugin *plugin = api->cls; 1118 struct Plugin *plugin = api->cls;
1119 struct RequestHandle *request;
1094 struct EgoEntry *ego_entry; 1120 struct EgoEntry *ego_entry;
1095 struct EgoEntry *ego_tmp; 1121 struct EgoEntry *ego_tmp;
1096 1122
1097 plugin->cfg = NULL; 1123 plugin->cfg = NULL;
1124 while (NULL != (request = requests_head))
1125 do_error (request);
1098 if (NULL != identity_handle) 1126 if (NULL != identity_handle)
1099 GNUNET_IDENTITY_disconnect (identity_handle); 1127 GNUNET_IDENTITY_disconnect (identity_handle);
1100 if (NULL != ns_handle) 1128 if (NULL != ns_handle)