aboutsummaryrefslogtreecommitdiff
path: root/src/set/set_api.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/set/set_api.c')
-rw-r--r--src/set/set_api.c38
1 files changed, 1 insertions, 37 deletions
diff --git a/src/set/set_api.c b/src/set/set_api.c
index 775e390de..5838680b9 100644
--- a/src/set/set_api.c
+++ b/src/set/set_api.c
@@ -1,6 +1,6 @@
1/* 1/*
2 This file is part of GNUnet. 2 This file is part of GNUnet.
3 (C) 2012 Christian Grothoff (and other contributing authors) 3 (C) 2012, 2013 Christian Grothoff (and other contributing authors)
4 4
5 GNUnet is free software; you can redistribute it and/or modify 5 GNUnet is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published 6 it under the terms of the GNU General Public License as published
@@ -29,8 +29,6 @@
29#include "gnunet_client_lib.h" 29#include "gnunet_client_lib.h"
30#include "gnunet_set_service.h" 30#include "gnunet_set_service.h"
31#include "set.h" 31#include "set.h"
32#include "mq.h"
33#include <inttypes.h>
34 32
35 33
36#define LOG(kind,...) GNUNET_log_from (kind, "set-api",__VA_ARGS__) 34#define LOG(kind,...) GNUNET_log_from (kind, "set-api",__VA_ARGS__)
@@ -61,7 +59,6 @@ struct GNUNET_SET_OperationHandle
61 void *result_cls; 59 void *result_cls;
62 struct GNUNET_SET_Handle *set; 60 struct GNUNET_SET_Handle *set;
63 uint32_t request_id; 61 uint32_t request_id;
64 GNUNET_SCHEDULER_TaskIdentifier timeout_task;
65}; 62};
66 63
67 64
@@ -104,11 +101,6 @@ handle_result (void *cls, const struct GNUNET_MessageHeader *mh)
104 * and this is the last result message we get */ 101 * and this is the last result message we get */
105 if (htons (msg->result_status) != GNUNET_SET_STATUS_OK) 102 if (htons (msg->result_status) != GNUNET_SET_STATUS_OK)
106 { 103 {
107 if (GNUNET_SCHEDULER_NO_TASK != oh->timeout_task)
108 {
109 GNUNET_SCHEDULER_cancel (oh->timeout_task);
110 oh->timeout_task = GNUNET_SCHEDULER_NO_TASK;
111 }
112 GNUNET_MQ_assoc_remove (set->mq, ntohl (msg->request_id)); 104 GNUNET_MQ_assoc_remove (set->mq, ntohl (msg->request_id));
113 if (NULL != oh->result_cb) 105 if (NULL != oh->result_cb)
114 oh->result_cb (oh->result_cls, NULL, htons (msg->result_status)); 106 oh->result_cb (oh->result_cls, NULL, htons (msg->result_status));
@@ -264,26 +256,6 @@ GNUNET_SET_destroy (struct GNUNET_SET_Handle *set)
264 256
265 257
266/** 258/**
267 * Signature of the main function of a task.
268 *
269 * @param cls closure
270 * @param tc context information (why was this task triggered now)
271 */
272static void
273operation_timeout_task (void *cls,
274 const struct GNUNET_SCHEDULER_TaskContext * tc)
275{
276 struct GNUNET_SET_OperationHandle *oh = cls;
277 oh->timeout_task = GNUNET_SCHEDULER_NO_TASK;
278 if (NULL != oh->result_cb)
279 oh->result_cb (oh->result_cls, NULL, GNUNET_SET_STATUS_TIMEOUT);
280 oh->result_cb = NULL;
281 oh->result_cls = NULL;
282 GNUNET_SET_operation_cancel (oh);
283}
284
285
286/**
287 * Evaluate a set operation with our set and the set of another peer. 259 * Evaluate a set operation with our set and the set of another peer.
288 * 260 *
289 * @param set set to use 261 * @param set set to use
@@ -294,8 +266,6 @@ operation_timeout_task (void *cls,
294 * @param salt salt used for the set operation; sometimes set operations 266 * @param salt salt used for the set operation; sometimes set operations
295 * fail due to hash collisions, using a different salt for each operation 267 * fail due to hash collisions, using a different salt for each operation
296 * makes it harder for an attacker to exploit this 268 * makes it harder for an attacker to exploit this
297 * @param timeout result_cb will be called with GNUNET_SET_STATUS_TIMEOUT
298 * if the operation is not done after the specified time
299 * @param result_mode specified how results will be returned, 269 * @param result_mode specified how results will be returned,
300 * see 'GNUNET_SET_ResultMode'. 270 * see 'GNUNET_SET_ResultMode'.
301 * @param result_cb called on error or success 271 * @param result_cb called on error or success
@@ -308,7 +278,6 @@ GNUNET_SET_evaluate (struct GNUNET_SET_Handle *set,
308 const struct GNUNET_HashCode *app_id, 278 const struct GNUNET_HashCode *app_id,
309 const struct GNUNET_MessageHeader *context_msg, 279 const struct GNUNET_MessageHeader *context_msg,
310 uint16_t salt, 280 uint16_t salt,
311 struct GNUNET_TIME_Relative timeout,
312 enum GNUNET_SET_ResultMode result_mode, 281 enum GNUNET_SET_ResultMode result_mode,
313 GNUNET_SET_ResultIterator result_cb, 282 GNUNET_SET_ResultIterator result_cb,
314 void *result_cls) 283 void *result_cls)
@@ -331,7 +300,6 @@ GNUNET_SET_evaluate (struct GNUNET_SET_Handle *set,
331 if (GNUNET_OK != GNUNET_MQ_nest (mqm, context_msg, ntohs (context_msg->size))) 300 if (GNUNET_OK != GNUNET_MQ_nest (mqm, context_msg, ntohs (context_msg->size)))
332 GNUNET_assert (0); 301 GNUNET_assert (0);
333 302
334 oh->timeout_task = GNUNET_SCHEDULER_add_delayed (timeout, operation_timeout_task, oh);
335 GNUNET_MQ_send (set->mq, mqm); 303 GNUNET_MQ_send (set->mq, mqm);
336 304
337 return oh; 305 return oh;
@@ -399,7 +367,6 @@ GNUNET_SET_listen_cancel (struct GNUNET_SET_ListenHandle *lh)
399 * 367 *
400 * @param request request to accept 368 * @param request request to accept
401 * @param set set used for the requested operation 369 * @param set set used for the requested operation
402 * @param timeout timeout for the set operation
403 * @param result_mode specified how results will be returned, 370 * @param result_mode specified how results will be returned,
404 * see 'GNUNET_SET_ResultMode'. 371 * see 'GNUNET_SET_ResultMode'.
405 * @param result_cb callback for the results 372 * @param result_cb callback for the results
@@ -409,7 +376,6 @@ GNUNET_SET_listen_cancel (struct GNUNET_SET_ListenHandle *lh)
409struct GNUNET_SET_OperationHandle * 376struct GNUNET_SET_OperationHandle *
410GNUNET_SET_accept (struct GNUNET_SET_Request *request, 377GNUNET_SET_accept (struct GNUNET_SET_Request *request,
411 struct GNUNET_SET_Handle *set, 378 struct GNUNET_SET_Handle *set,
412 struct GNUNET_TIME_Relative timeout,
413 enum GNUNET_SET_ResultMode result_mode, 379 enum GNUNET_SET_ResultMode result_mode,
414 GNUNET_SET_ResultIterator result_cb, 380 GNUNET_SET_ResultIterator result_cb,
415 void *result_cls) 381 void *result_cls)
@@ -432,8 +398,6 @@ GNUNET_SET_accept (struct GNUNET_SET_Request *request,
432 msg->accept_id = htonl (request->accept_id); 398 msg->accept_id = htonl (request->accept_id);
433 GNUNET_MQ_send (set->mq, mqm); 399 GNUNET_MQ_send (set->mq, mqm);
434 400
435 oh->timeout_task = GNUNET_SCHEDULER_add_delayed (timeout, operation_timeout_task, oh);
436
437 return oh; 401 return oh;
438} 402}
439 403