diff options
author | Matthias Wachs <wachs@net.in.tum.de> | 2014-03-28 15:09:29 +0000 |
---|---|---|
committer | Matthias Wachs <wachs@net.in.tum.de> | 2014-03-28 15:09:29 +0000 |
commit | bfa96bbe8cc79655a3e5611d1bbcaf47ccae6f2a (patch) | |
tree | 876a928acd88ff049bb9d660c937bc2fa91d8ed5 /src/transport/gnunet-service-transport_neighbours.c | |
parent | 6142516fdf010fd5aa0d13f773bf5edf3b1eae22 (diff) | |
download | gnunet-bfa96bbe8cc79655a3e5611d1bbcaf47ccae6f2a.tar.gz gnunet-bfa96bbe8cc79655a3e5611d1bbcaf47ccae6f2a.zip |
cancel delayed disconnect task on free
Diffstat (limited to 'src/transport/gnunet-service-transport_neighbours.c')
-rw-r--r-- | src/transport/gnunet-service-transport_neighbours.c | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/src/transport/gnunet-service-transport_neighbours.c b/src/transport/gnunet-service-transport_neighbours.c index 2b3d96a55..ac4a44658 100644 --- a/src/transport/gnunet-service-transport_neighbours.c +++ b/src/transport/gnunet-service-transport_neighbours.c | |||
@@ -343,6 +343,11 @@ struct NeighbourMapEntry | |||
343 | GNUNET_SCHEDULER_TaskIdentifier task; | 343 | GNUNET_SCHEDULER_TaskIdentifier task; |
344 | 344 | ||
345 | /** | 345 | /** |
346 | * Task to disconnect neighbour after we received a DISCONNECT message | ||
347 | */ | ||
348 | GNUNET_SCHEDULER_TaskIdentifier delayed_disconnect_task; | ||
349 | |||
350 | /** | ||
346 | * At what time should we sent the next keep-alive message? | 351 | * At what time should we sent the next keep-alive message? |
347 | */ | 352 | */ |
348 | struct GNUNET_TIME_Absolute keep_alive_time; | 353 | struct GNUNET_TIME_Absolute keep_alive_time; |
@@ -946,6 +951,13 @@ free_neighbour (struct NeighbourMapEntry *n, | |||
946 | n->suggest_handle = NULL; | 951 | n->suggest_handle = NULL; |
947 | } | 952 | } |
948 | 953 | ||
954 | /* Cancel the disconnect task */ | ||
955 | if (GNUNET_SCHEDULER_NO_TASK != n->delayed_disconnect_task) | ||
956 | { | ||
957 | GNUNET_SCHEDULER_cancel (n->delayed_disconnect_task); | ||
958 | n->delayed_disconnect_task = GNUNET_SCHEDULER_NO_TASK; | ||
959 | } | ||
960 | |||
949 | /* Cancel the master task */ | 961 | /* Cancel the master task */ |
950 | if (GNUNET_SCHEDULER_NO_TASK != n->task) | 962 | if (GNUNET_SCHEDULER_NO_TASK != n->task) |
951 | { | 963 | { |
@@ -3479,11 +3491,8 @@ void delayed_disconnect (void *cls, | |||
3479 | const struct GNUNET_SCHEDULER_TaskContext* tc) | 3491 | const struct GNUNET_SCHEDULER_TaskContext* tc) |
3480 | { | 3492 | { |
3481 | struct NeighbourMapEntry *n = cls; | 3493 | struct NeighbourMapEntry *n = cls; |
3482 | if (GNUNET_YES == test_connected (n)) | 3494 | |
3483 | GNUNET_STATISTICS_update (GST_stats, | 3495 | n->delayed_disconnect_task = GNUNET_SCHEDULER_NO_TASK; |
3484 | gettext_noop | ||
3485 | ("# other peer asked to disconnect from us"), 1, | ||
3486 | GNUNET_NO); | ||
3487 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 3496 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
3488 | "Disconnecting by request from peer %s\n", | 3497 | "Disconnecting by request from peer %s\n", |
3489 | GNUNET_i2s (&n->id)); | 3498 | GNUNET_i2s (&n->id)); |
@@ -3561,7 +3570,7 @@ GST_neighbours_handle_disconnect_message (const struct GNUNET_PeerIdentity *peer | |||
3561 | GNUNET_break_op (0); | 3570 | GNUNET_break_op (0); |
3562 | return; | 3571 | return; |
3563 | } | 3572 | } |
3564 | GNUNET_SCHEDULER_add_now (&delayed_disconnect, n); | 3573 | n->delayed_disconnect_task = GNUNET_SCHEDULER_add_now (&delayed_disconnect, n); |
3565 | } | 3574 | } |
3566 | 3575 | ||
3567 | 3576 | ||