diff options
author | Nathan S. Evans <evans@in.tum.de> | 2010-10-15 12:11:44 +0000 |
---|---|---|
committer | Nathan S. Evans <evans@in.tum.de> | 2010-10-15 12:11:44 +0000 |
commit | 2ad4ee74907e787e651682abd488836b4aa68ca0 (patch) | |
tree | 41796c11cfa7ae48464772430b90442a7e382e93 /src/core | |
parent | 4983163bc655865da6b0de4e2ef9a23a0b230794 (diff) | |
download | gnunet-2ad4ee74907e787e651682abd488836b4aa68ca0.tar.gz gnunet-2ad4ee74907e787e651682abd488836b4aa68ca0.zip |
core_api possible fix for timeout case
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/core_api.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/src/core/core_api.c b/src/core/core_api.c index c21be318a..52a36342c 100644 --- a/src/core/core_api.c +++ b/src/core/core_api.c | |||
@@ -292,6 +292,9 @@ timeout_request (void *cls, | |||
292 | { | 292 | { |
293 | struct GNUNET_CORE_TransmitHandle *th = cls; | 293 | struct GNUNET_CORE_TransmitHandle *th = cls; |
294 | 294 | ||
295 | GNUNET_CONTAINER_DLL_remove (th->ch->pending_head, | ||
296 | th->ch->pending_tail, | ||
297 | th); | ||
295 | th->timeout_task = GNUNET_SCHEDULER_NO_TASK; | 298 | th->timeout_task = GNUNET_SCHEDULER_NO_TASK; |
296 | #if DEBUG_CORE | 299 | #if DEBUG_CORE |
297 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 300 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
@@ -323,6 +326,8 @@ request_start (void *cls, size_t size, void *buf) | |||
323 | return 0; | 326 | return 0; |
324 | if (buf == NULL) | 327 | if (buf == NULL) |
325 | { | 328 | { |
329 | if (th->timeout_task != GNUNET_SCHEDULER_NO_TASK) | ||
330 | GNUNET_SCHEDULER_cancel(h->sched, th->timeout_task); | ||
326 | timeout_request (th, NULL); | 331 | timeout_request (th, NULL); |
327 | return 0; | 332 | return 0; |
328 | } | 333 | } |
@@ -844,7 +849,13 @@ produce_send (void *cls, size_t size, void *buf) | |||
844 | #endif | 849 | #endif |
845 | GNUNET_assert (0 == th->notify (th->notify_cls, 0, NULL)); | 850 | GNUNET_assert (0 == th->notify (th->notify_cls, 0, NULL)); |
846 | GNUNET_CORE_notify_transmit_ready_cancel (th); | 851 | GNUNET_CORE_notify_transmit_ready_cancel (th); |
847 | trigger_next_request (h); | 852 | if ((h->pending_head == th) && (h->cth != NULL)) /* Request hasn't been canceled yet! */ |
853 | { | ||
854 | GNUNET_CLIENT_notify_transmit_ready_cancel (h->cth); | ||
855 | h->cth = NULL; | ||
856 | trigger_next_request (h); | ||
857 | } | ||
858 | /* Otherwise this request timed out, but another is actually queued for sending, so don't try to send another! */ | ||
848 | return 0; | 859 | return 0; |
849 | } | 860 | } |
850 | sm = (struct SendMessage *) buf; | 861 | sm = (struct SendMessage *) buf; |