diff options
Diffstat (limited to 'src/transport/gnunet-service-transport_neighbours.c')
-rw-r--r-- | src/transport/gnunet-service-transport_neighbours.c | 31 |
1 files changed, 27 insertions, 4 deletions
diff --git a/src/transport/gnunet-service-transport_neighbours.c b/src/transport/gnunet-service-transport_neighbours.c index 211595b51..604112560 100644 --- a/src/transport/gnunet-service-transport_neighbours.c +++ b/src/transport/gnunet-service-transport_neighbours.c | |||
@@ -815,10 +815,6 @@ GST_neighbours_calculate_receive_delay (const struct GNUNET_PeerIdentity *sender | |||
815 | n->quota_violation_count--; | 815 | n->quota_violation_count--; |
816 | } | 816 | } |
817 | } | 817 | } |
818 | GNUNET_SCHEDULER_cancel (n->timeout_task); | ||
819 | n->timeout_task = | ||
820 | GNUNET_SCHEDULER_add_delayed (GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT, | ||
821 | &neighbour_timeout_task, n); | ||
822 | if (n->quota_violation_count > QUOTA_VIOLATION_DROP_THRESHOLD) | 818 | if (n->quota_violation_count > QUOTA_VIOLATION_DROP_THRESHOLD) |
823 | { | 819 | { |
824 | GNUNET_STATISTICS_update (GST_stats, | 820 | GNUNET_STATISTICS_update (GST_stats, |
@@ -849,6 +845,33 @@ GST_neighbours_calculate_receive_delay (const struct GNUNET_PeerIdentity *sender | |||
849 | 845 | ||
850 | 846 | ||
851 | /** | 847 | /** |
848 | * Keep the connection to the given neighbour alive longer, | ||
849 | * we received a KEEPALIVE (or equivalent). | ||
850 | * | ||
851 | * @param neighbour neighbour to keep alive | ||
852 | */ | ||
853 | void | ||
854 | GST_neighbours_keepalive (const struct GNUNET_PeerIdentity *neighbour) | ||
855 | { | ||
856 | struct NeighbourMapEntry *n; | ||
857 | |||
858 | n = lookup_neighbour (neighbour); | ||
859 | if (NULL == n) | ||
860 | { | ||
861 | GNUNET_STATISTICS_update (GST_stats, | ||
862 | gettext_noop ("# KEEPALIVE messages discarded (not connected)"), | ||
863 | 1, | ||
864 | GNUNET_NO); | ||
865 | return; | ||
866 | } | ||
867 | GNUNET_SCHEDULER_cancel (n->timeout_task); | ||
868 | n->timeout_task = | ||
869 | GNUNET_SCHEDULER_add_delayed (GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT, | ||
870 | &neighbour_timeout_task, n); | ||
871 | } | ||
872 | |||
873 | |||
874 | /** | ||
852 | * Change the incoming quota for the given peer. | 875 | * Change the incoming quota for the given peer. |
853 | * | 876 | * |
854 | * @param neighbour identity of peer to change qutoa for | 877 | * @param neighbour identity of peer to change qutoa for |