aboutsummaryrefslogtreecommitdiff
path: root/src/transport
diff options
context:
space:
mode:
authorMatthias Wachs <wachs@net.in.tum.de>2011-10-24 15:20:25 +0000
committerMatthias Wachs <wachs@net.in.tum.de>2011-10-24 15:20:25 +0000
commit227d261c1ff256be9dea7bf98e5e07f7875dcde0 (patch)
treef8ba51d5fdd25e73fbcc1b52035c1e52ce727d00 /src/transport
parent41cc20177acc37e335f4d8587e9ee5fa3bb3ea2e (diff)
downloadgnunet-227d261c1ff256be9dea7bf98e5e07f7875dcde0.tar.gz
gnunet-227d261c1ff256be9dea7bf98e5e07f7875dcde0.zip
fixing 1841
- transmission_task scheduled 2x without checking on task_identifier - added assertion to see if bug is still existing - schedule task on if transmission was succesful
Diffstat (limited to 'src/transport')
-rw-r--r--src/transport/gnunet-service-transport_neighbours.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/transport/gnunet-service-transport_neighbours.c b/src/transport/gnunet-service-transport_neighbours.c
index 2f11d5ae3..ba9692566 100644
--- a/src/transport/gnunet-service-transport_neighbours.c
+++ b/src/transport/gnunet-service-transport_neighbours.c
@@ -349,12 +349,15 @@ transmit_send_continuation (void *cls,
349 349
350 mq = cls; 350 mq = cls;
351 n = mq->n; 351 n = mq->n;
352 if (NULL != n) 352 if ((NULL != n))
353 { 353 {
354 GNUNET_assert (n->is_active == mq); 354 GNUNET_assert (n->is_active == mq);
355 n->is_active = NULL; 355 n->is_active = NULL;
356 GNUNET_assert (n->transmission_task == GNUNET_SCHEDULER_NO_TASK); 356 if (success == GNUNET_YES)
357 n->transmission_task = GNUNET_SCHEDULER_add_now (&transmission_task, n); 357 {
358 GNUNET_assert (n->transmission_task == GNUNET_SCHEDULER_NO_TASK);
359 n->transmission_task = GNUNET_SCHEDULER_add_now (&transmission_task, n);
360 }
358 } 361 }
359 if (NULL != mq->cont) 362 if (NULL != mq->cont)
360 mq->cont (mq->cont_cls, success); 363 mq->cont (mq->cont_cls, success);
@@ -408,6 +411,7 @@ try_transmission_to_peer (struct NeighbourMapEntry *n)
408 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "No address for peer `%s'\n", 411 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "No address for peer `%s'\n",
409 GNUNET_i2s (&n->id)); 412 GNUNET_i2s (&n->id));
410 transmit_send_continuation (mq, &n->id, GNUNET_SYSERR); 413 transmit_send_continuation (mq, &n->id, GNUNET_SYSERR);
414 GNUNET_assert (n->transmission_task == GNUNET_SCHEDULER_NO_TASK);
411 n->transmission_task = GNUNET_SCHEDULER_add_now (&transmission_task, n); 415 n->transmission_task = GNUNET_SCHEDULER_add_now (&transmission_task, n);
412 return; 416 return;
413 } 417 }
@@ -422,7 +426,6 @@ try_transmission_to_peer (struct NeighbourMapEntry *n)
422 /* failure, but 'send' would not call continuation in this case, 426 /* failure, but 'send' would not call continuation in this case,
423 * so we need to do it here! */ 427 * so we need to do it here! */
424 transmit_send_continuation (mq, &n->id, GNUNET_SYSERR); 428 transmit_send_continuation (mq, &n->id, GNUNET_SYSERR);
425 n->transmission_task = GNUNET_SCHEDULER_add_now (&transmission_task, n);
426 } 429 }
427} 430}
428 431
@@ -437,7 +440,7 @@ static void
437transmission_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) 440transmission_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
438{ 441{
439 struct NeighbourMapEntry *n = cls; 442 struct NeighbourMapEntry *n = cls;
440 443 GNUNET_assert (NULL != lookup_neighbour(&n->id));
441 n->transmission_task = GNUNET_SCHEDULER_NO_TASK; 444 n->transmission_task = GNUNET_SCHEDULER_NO_TASK;
442 try_transmission_to_peer (n); 445 try_transmission_to_peer (n);
443} 446}
@@ -640,6 +643,7 @@ send_connect_continuation (void *cls,
640{ 643{
641 struct NeighbourMapEntry *n = cls; 644 struct NeighbourMapEntry *n = cls;
642 645
646 GNUNET_assert (n != NULL);
643 if (GNUNET_YES == n->in_disconnect) 647 if (GNUNET_YES == n->in_disconnect)
644 return; /* neighbour is going away */ 648 return; /* neighbour is going away */
645 if (GNUNET_YES != success) 649 if (GNUNET_YES != success)