diff options
author | Christian Grothoff <christian@grothoff.org> | 2011-10-16 13:42:55 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2011-10-16 13:42:55 +0000 |
commit | c2e92effeacc3cb83fa928427d0ae172c7257d82 (patch) | |
tree | 7f74379149303595fd4b679cc23812de84ed93c8 /src | |
parent | b712700e740862c9ea773a5eb95eec9924a9b57e (diff) | |
download | gnunet-c2e92effeacc3cb83fa928427d0ae172c7257d82.tar.gz gnunet-c2e92effeacc3cb83fa928427d0ae172c7257d82.zip |
trying to fix keepalive logic
Diffstat (limited to 'src')
-rw-r--r-- | src/transport/gnunet-service-transport_neighbours.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/src/transport/gnunet-service-transport_neighbours.c b/src/transport/gnunet-service-transport_neighbours.c index b0e639984..086768dce 100644 --- a/src/transport/gnunet-service-transport_neighbours.c +++ b/src/transport/gnunet-service-transport_neighbours.c | |||
@@ -550,7 +550,9 @@ neighbour_keepalive_task (void *cls, | |||
550 | struct GNUNET_MessageHeader m; | 550 | struct GNUNET_MessageHeader m; |
551 | struct GNUNET_TRANSPORT_PluginFunctions *papi; | 551 | struct GNUNET_TRANSPORT_PluginFunctions *papi; |
552 | 552 | ||
553 | n->keepalive_task = GNUNET_SCHEDULER_NO_TASK; | 553 | n->keepalive_task = GNUNET_SCHEDULER_add_delayed (KEEPALIVE_FREQUENCY, |
554 | &neighbour_keepalive_task, | ||
555 | n); | ||
554 | GNUNET_assert (GNUNET_YES == n->is_connected); | 556 | GNUNET_assert (GNUNET_YES == n->is_connected); |
555 | GNUNET_STATISTICS_update (GST_stats, | 557 | GNUNET_STATISTICS_update (GST_stats, |
556 | gettext_noop ("# keepalives sent"), 1, | 558 | gettext_noop ("# keepalives sent"), 1, |
@@ -565,9 +567,6 @@ neighbour_keepalive_task (void *cls, | |||
565 | UINT32_MAX /* priority */ , | 567 | UINT32_MAX /* priority */ , |
566 | GNUNET_TIME_UNIT_FOREVER_REL, n->session, n->addr, n->addrlen, | 568 | GNUNET_TIME_UNIT_FOREVER_REL, n->session, n->addr, n->addrlen, |
567 | GNUNET_YES, NULL, NULL); | 569 | GNUNET_YES, NULL, NULL); |
568 | n->keepalive_task = GNUNET_SCHEDULER_add_delayed (KEEPALIVE_FREQUENCY, | ||
569 | &neighbour_keepalive_task, | ||
570 | n); | ||
571 | } | 570 | } |
572 | 571 | ||
573 | 572 | ||
@@ -651,6 +650,8 @@ GST_neighbours_switch_to_address (const struct GNUNET_PeerIdentity *peer, | |||
651 | } | 650 | } |
652 | was_connected = n->is_connected; | 651 | was_connected = n->is_connected; |
653 | n->is_connected = GNUNET_YES; | 652 | n->is_connected = GNUNET_YES; |
653 | n->keepalive_task = GNUNET_SCHEDULER_add_now (&neighbour_keepalive_task, | ||
654 | n); | ||
654 | 655 | ||
655 | #if DEBUG_TRANSPORT | 656 | #if DEBUG_TRANSPORT |
656 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 657 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
@@ -682,8 +683,6 @@ GST_neighbours_switch_to_address (const struct GNUNET_PeerIdentity *peer, | |||
682 | GST_neighbours_send (peer, &connect_msg, sizeof (connect_msg), | 683 | GST_neighbours_send (peer, &connect_msg, sizeof (connect_msg), |
683 | GNUNET_TIME_UNIT_FOREVER_REL, NULL, NULL); | 684 | GNUNET_TIME_UNIT_FOREVER_REL, NULL, NULL); |
684 | 685 | ||
685 | n->keepalive_task = GNUNET_SCHEDULER_add_now (&neighbour_keepalive_task, | ||
686 | n); | ||
687 | if (GNUNET_YES == was_connected) | 686 | if (GNUNET_YES == was_connected) |
688 | return; | 687 | return; |
689 | /* First tell clients about connected neighbours...*/ | 688 | /* First tell clients about connected neighbours...*/ |