aboutsummaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2010-05-20 12:20:43 +0000
committerChristian Grothoff <christian@grothoff.org>2010-05-20 12:20:43 +0000
commitf89b2594b091ff1a8434dffb840754915c45ed76 (patch)
tree19395e7fcfdeb294a7a4163c189e7665c1f4a606 /src/core
parent5a221564de2abb721f3ba5fabbdd74cc502e424e (diff)
downloadgnunet-f89b2594b091ff1a8434dffb840754915c45ed76.tar.gz
gnunet-f89b2594b091ff1a8434dffb840754915c45ed76.zip
use DLL macros
Diffstat (limited to 'src/core')
-rw-r--r--src/core/core_api.c32
1 files changed, 11 insertions, 21 deletions
diff --git a/src/core/core_api.c b/src/core/core_api.c
index 51260c969..10c465a89 100644
--- a/src/core/core_api.c
+++ b/src/core/core_api.c
@@ -310,17 +310,14 @@ request_start (void *cls, size_t size, void *buf)
310 return 0; 310 return 0;
311 } 311 }
312 /* create new timeout task (in case core takes too long to respond!) */ 312 /* create new timeout task (in case core takes too long to respond!) */
313 GNUNET_assert (GNUNET_SCHEDULER_NO_TASK == th->timeout_task);
313 th->timeout_task = GNUNET_SCHEDULER_add_delayed (h->sched, 314 th->timeout_task = GNUNET_SCHEDULER_add_delayed (h->sched,
314 GNUNET_TIME_absolute_get_remaining 315 GNUNET_TIME_absolute_get_remaining
315 (th->timeout), 316 (th->timeout),
316 &timeout_request, th); 317 &timeout_request, th);
317 /* remove th from doubly-linked pending list, move to submitted */ 318 GNUNET_CONTAINER_DLL_remove (h->pending_head,
318 GNUNET_assert (th->prev == NULL); 319 h->pending_tail,
319 h->pending_head = th->next; 320 th);
320 if (th->next == NULL)
321 h->pending_tail = NULL;
322 else
323 th->next->prev = NULL;
324 GNUNET_assert (h->submitted == NULL); 321 GNUNET_assert (h->submitted == NULL);
325 h->submitted = th; 322 h->submitted = th;
326 GNUNET_assert (size >= th->msize); 323 GNUNET_assert (size >= th->msize);
@@ -882,12 +879,10 @@ GNUNET_CORE_notify_transmit_ready (struct GNUNET_CORE_Handle *handle,
882 GNUNET_SERVER_MAX_MESSAGE_SIZE); 879 GNUNET_SERVER_MAX_MESSAGE_SIZE);
883 th = GNUNET_malloc (sizeof (struct GNUNET_CORE_TransmitHandle)); 880 th = GNUNET_malloc (sizeof (struct GNUNET_CORE_TransmitHandle));
884 th->ch = handle; 881 th->ch = handle;
885 /* append to list */ 882 GNUNET_CONTAINER_DLL_insert_after (handle->pending_head,
886 th->prev = handle->pending_tail; 883 handle->pending_tail,
887 if (handle->pending_tail == NULL) 884 handle->pending_tail,
888 handle->pending_head = th; 885 th);
889 else
890 handle->pending_tail->next = th;
891 th->get_message = &produce_send; 886 th->get_message = &produce_send;
892 th->get_message_cls = th; 887 th->get_message_cls = th;
893 th->notify = notify; 888 th->notify = notify;
@@ -924,14 +919,9 @@ GNUNET_CORE_notify_transmit_ready_cancel (struct GNUNET_CORE_TransmitHandle
924 } 919 }
925 else 920 else
926 { 921 {
927 if (h->prev == NULL) 922 GNUNET_CONTAINER_DLL_remove (handle->pending_head,
928 handle->pending_head = h->next; 923 handle->pending_tail,
929 else 924 h);
930 h->prev->next = h->next;
931 if (h->next == NULL)
932 handle->pending_tail = h->prev;
933 else
934 h->next->prev = h->prev;
935 } 925 }
936 if (h->timeout_task != GNUNET_SCHEDULER_NO_TASK) 926 if (h->timeout_task != GNUNET_SCHEDULER_NO_TASK)
937 GNUNET_SCHEDULER_cancel (handle->sched, h->timeout_task); 927 GNUNET_SCHEDULER_cancel (handle->sched, h->timeout_task);