aboutsummaryrefslogtreecommitdiff
path: root/src/rest/plugin_rest_config.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/rest/plugin_rest_config.c')
-rw-r--r--src/rest/plugin_rest_config.c31
1 files changed, 29 insertions, 2 deletions
diff --git a/src/rest/plugin_rest_config.c b/src/rest/plugin_rest_config.c
index e5d0fffb0..af833efff 100644
--- a/src/rest/plugin_rest_config.c
+++ b/src/rest/plugin_rest_config.c
@@ -45,6 +45,16 @@ const struct GNUNET_CONFIGURATION_Handle *cfg;
45struct RequestHandle 45struct RequestHandle
46{ 46{
47 /** 47 /**
48 * DLL
49 */
50 struct RequestHandle *next;
51
52 /**
53 * DLL
54 */
55 struct RequestHandle *prev;
56
57 /**
48 * Handle to rest request 58 * Handle to rest request
49 */ 59 */
50 struct GNUNET_REST_RequestHandle *rest_handle; 60 struct GNUNET_REST_RequestHandle *rest_handle;
@@ -70,6 +80,17 @@ struct RequestHandle
70 char *url; 80 char *url;
71}; 81};
72 82
83/**
84 * DLL
85 */
86static struct RequestHandle *requests_head;
87
88/**
89 * DLL
90 */
91static struct RequestHandle *requests_tail;
92
93
73 94
74/** 95/**
75 * Cleanup request handle. 96 * Cleanup request handle.
@@ -82,6 +103,9 @@ cleanup_handle (struct RequestHandle *handle)
82 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Cleaning up\n"); 103 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Cleaning up\n");
83 if (NULL != handle->url) 104 if (NULL != handle->url)
84 GNUNET_free (handle->url); 105 GNUNET_free (handle->url);
106 GNUNET_CONTAINER_DLL_remove (requests_head,
107 requests_tail,
108 handle);
85 GNUNET_free (handle); 109 GNUNET_free (handle);
86} 110}
87 111
@@ -367,7 +391,9 @@ rest_config_process_request (struct GNUNET_REST_RequestHandle *conndata_handle,
367 handle->url = GNUNET_strdup (conndata_handle->url); 391 handle->url = GNUNET_strdup (conndata_handle->url);
368 if (handle->url[strlen (handle->url) - 1] == '/') 392 if (handle->url[strlen (handle->url) - 1] == '/')
369 handle->url[strlen (handle->url) - 1] = '\0'; 393 handle->url[strlen (handle->url) - 1] = '\0';
370 394 GNUNET_CONTAINER_DLL_insert (requests_head,
395 requests_tail,
396 handle);
371 if (GNUNET_NO == 397 if (GNUNET_NO ==
372 GNUNET_REST_handle_request (conndata_handle, handlers, &err, handle)) 398 GNUNET_REST_handle_request (conndata_handle, handlers, &err, handle))
373 { 399 {
@@ -415,8 +441,9 @@ libgnunet_plugin_rest_config_done (void *cls)
415 struct GNUNET_REST_Plugin *api = cls; 441 struct GNUNET_REST_Plugin *api = cls;
416 struct Plugin *plugin; 442 struct Plugin *plugin;
417 443
444 while (NULL != requests_head)
445 cleanup_handle (requests_head);
418 plugin = api->cls; 446 plugin = api->cls;
419
420 plugin->cfg = NULL; 447 plugin->cfg = NULL;
421 GNUNET_free (api); 448 GNUNET_free (api);
422 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "CONFIG REST plugin is finished\n"); 449 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "CONFIG REST plugin is finished\n");