aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSchanzenbach, Martin <mschanzenbach@posteo.de>2019-07-16 17:53:45 +0200
committerSchanzenbach, Martin <mschanzenbach@posteo.de>2019-07-16 17:53:45 +0200
commit6f0f8dc56e60eef5e3b718705564db5ba7947fe5 (patch)
tree699eb6511155f9ec519143e93e2c2dbfd798507c
parentb6cfd30f7f59d686f0d12aa1b51372c452880ca9 (diff)
downloadgnunet-6f0f8dc56e60eef5e3b718705564db5ba7947fe5.tar.gz
gnunet-6f0f8dc56e60eef5e3b718705564db5ba7947fe5.zip
no timeout for GNS request
-rw-r--r--src/gns/plugin_rest_gns.c36
1 files changed, 1 insertions, 35 deletions
diff --git a/src/gns/plugin_rest_gns.c b/src/gns/plugin_rest_gns.c
index a0a582a50..46babdc76 100644
--- a/src/gns/plugin_rest_gns.c
+++ b/src/gns/plugin_rest_gns.c
@@ -102,16 +102,6 @@ struct RequestHandle
102 struct GNUNET_REST_RequestHandle *rest_handle; 102 struct GNUNET_REST_RequestHandle *rest_handle;
103 103
104 /** 104 /**
105 * Desired timeout for the lookup (default is no timeout).
106 */
107 struct GNUNET_TIME_Relative timeout;
108
109 /**
110 * ID of a task associated with the resolution process.
111 */
112 struct GNUNET_SCHEDULER_Task *timeout_task;
113
114 /**
115 * The plugin result processor 105 * The plugin result processor
116 */ 106 */
117 GNUNET_REST_ResultProcessor proc; 107 GNUNET_REST_ResultProcessor proc;
@@ -161,11 +151,6 @@ cleanup_handle (void *cls)
161 handle->gns = NULL; 151 handle->gns = NULL;
162 } 152 }
163 153
164 if (NULL != handle->timeout_task)
165 {
166 GNUNET_SCHEDULER_cancel (handle->timeout_task);
167 handle->timeout_task = NULL;
168 }
169 if (NULL != handle->url) 154 if (NULL != handle->url)
170 GNUNET_free (handle->url); 155 GNUNET_free (handle->url);
171 if (NULL != handle->name) 156 if (NULL != handle->name)
@@ -190,16 +175,13 @@ do_error (void *cls)
190 json_t *json_error = json_object(); 175 json_t *json_error = json_object();
191 char *response; 176 char *response;
192 177
193 if (NULL != handle->timeout_task)
194 GNUNET_SCHEDULER_cancel (handle->timeout_task);
195 handle->timeout_task = NULL;
196 if (NULL == handle->emsg) 178 if (NULL == handle->emsg)
197 handle->emsg = GNUNET_strdup(GNUNET_REST_GNS_ERROR_UNKNOWN); 179 handle->emsg = GNUNET_strdup(GNUNET_REST_GNS_ERROR_UNKNOWN);
198 180
199 json_object_set_new(json_error,"error", json_string(handle->emsg)); 181 json_object_set_new(json_error,"error", json_string(handle->emsg));
200 182
201 if (0 == handle->response_code) 183 if (0 == handle->response_code)
202 handle->response_code = MHD_HTTP_OK; 184 handle->response_code = MHD_HTTP_INTERNAL_SERVER_ERROR;
203 response = json_dumps (json_error, 0); 185 response = json_dumps (json_error, 0);
204 resp = GNUNET_REST_create_response (response); 186 resp = GNUNET_REST_create_response (response);
205 handle->proc (handle->proc_cls, resp, handle->response_code); 187 handle->proc (handle->proc_cls, resp, handle->response_code);
@@ -209,16 +191,6 @@ do_error (void *cls)
209} 191}
210 192
211 193
212static void
213do_timeout (void *cls)
214{
215 struct RequestHandle *handle = cls;
216 handle->timeout_task = NULL;
217 handle->response_code = MHD_HTTP_REQUEST_TIMEOUT;
218 do_error (handle);
219}
220
221
222/** 194/**
223 * Iterator called on obtained result for a GNS lookup. 195 * Iterator called on obtained result for a GNS lookup.
224 * 196 *
@@ -398,7 +370,6 @@ rest_process_request(struct GNUNET_REST_RequestHandle *rest_handle,
398 struct RequestHandle *handle = GNUNET_new (struct RequestHandle); 370 struct RequestHandle *handle = GNUNET_new (struct RequestHandle);
399 371
400 handle->response_code = 0; 372 handle->response_code = 0;
401 handle->timeout = GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 60);
402 handle->proc_cls = proc_cls; 373 handle->proc_cls = proc_cls;
403 handle->proc = proc; 374 handle->proc = proc;
404 handle->rest_handle = rest_handle; 375 handle->rest_handle = rest_handle;
@@ -410,11 +381,6 @@ rest_process_request(struct GNUNET_REST_RequestHandle *rest_handle,
410 handle->gns = GNUNET_GNS_connect (cfg); 381 handle->gns = GNUNET_GNS_connect (cfg);
411 init_cont(handle); 382 init_cont(handle);
412 383
413 handle->timeout_task =
414 GNUNET_SCHEDULER_add_delayed (handle->timeout,
415 &do_timeout,
416 handle);
417
418 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Connected\n"); 384 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Connected\n");
419} 385}
420 386