diff options
author | Matthias Wachs <wachs@net.in.tum.de> | 2012-07-02 07:52:35 +0000 |
---|---|---|
committer | Matthias Wachs <wachs@net.in.tum.de> | 2012-07-02 07:52:35 +0000 |
commit | a8ac22b369ad152cc2422b738997768cc1761fc9 (patch) | |
tree | 6b33a1eb3d23ad115f2330ba31a0aee03afd6876 /src/transport/gnunet-service-transport_neighbours.c | |
parent | 0295e6f2f91ede1694693476f830ecf97400eab8 (diff) | |
download | gnunet-a8ac22b369ad152cc2422b738997768cc1761fc9.tar.gz gnunet-a8ac22b369ad152cc2422b738997768cc1761fc9.zip |
fix for mantis 2445 & 2471
Diffstat (limited to 'src/transport/gnunet-service-transport_neighbours.c')
-rw-r--r-- | src/transport/gnunet-service-transport_neighbours.c | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/src/transport/gnunet-service-transport_neighbours.c b/src/transport/gnunet-service-transport_neighbours.c index 23c8bdb35..d2cf8d6aa 100644 --- a/src/transport/gnunet-service-transport_neighbours.c +++ b/src/transport/gnunet-service-transport_neighbours.c | |||
@@ -870,7 +870,7 @@ free_neighbour (struct NeighbourMapEntry *n, int keep_sessions) | |||
870 | { | 870 | { |
871 | struct MessageQueue *mq; | 871 | struct MessageQueue *mq; |
872 | struct GNUNET_TRANSPORT_PluginFunctions *papi; | 872 | struct GNUNET_TRANSPORT_PluginFunctions *papi; |
873 | //struct GNUNET_HELLO_Address *old_address; | 873 | struct GNUNET_HELLO_Address *backup_primary; |
874 | 874 | ||
875 | n->is_active = NULL; /* always free'd by its own continuation! */ | 875 | n->is_active = NULL; /* always free'd by its own continuation! */ |
876 | 876 | ||
@@ -893,11 +893,16 @@ free_neighbour (struct NeighbourMapEntry *n, int keep_sessions) | |||
893 | disconnect_notify_cb (callback_cls, &n->id); | 893 | disconnect_notify_cb (callback_cls, &n->id); |
894 | } | 894 | } |
895 | 895 | ||
896 | n->state = S_DISCONNECT_FINISHED; | ||
896 | 897 | ||
897 | /* cut transport-level connection */ | 898 | if (NULL != n->primary_address.address) |
898 | //old_address = GNUNET_HELLO_address_copy(n->primary_address.address); | 899 | backup_primary = GNUNET_HELLO_address_copy(n->primary_address.address); |
899 | 900 | else | |
901 | backup_primary = NULL; | ||
900 | 902 | ||
903 | /* free addresses and mark as unused */ | ||
904 | free_address (&n->primary_address); | ||
905 | free_address (&n->alternative_address); | ||
901 | 906 | ||
902 | /* FIXME-PLUGIN-API: This does not seem to guarantee that all | 907 | /* FIXME-PLUGIN-API: This does not seem to guarantee that all |
903 | transport sessions eventually get killed due to inactivity; they | 908 | transport sessions eventually get killed due to inactivity; they |
@@ -909,16 +914,13 @@ free_neighbour (struct NeighbourMapEntry *n, int keep_sessions) | |||
909 | them! Killing all sessions like this seems to be very, very | 914 | them! Killing all sessions like this seems to be very, very |
910 | wrong. */ | 915 | wrong. */ |
911 | 916 | ||
917 | /* cut transport-level connection */ | ||
912 | if ((GNUNET_NO == keep_sessions) && | 918 | if ((GNUNET_NO == keep_sessions) && |
913 | (NULL != n->primary_address.address) && | 919 | (NULL != backup_primary) && |
914 | (NULL != (papi = GST_plugins_find (n->primary_address.address->transport_name)))) | 920 | (NULL != (papi = GST_plugins_find (backup_primary->transport_name)))) |
915 | papi->disconnect (papi->cls, &n->id); | 921 | papi->disconnect (papi->cls, &n->id); |
916 | 922 | ||
917 | 923 | GNUNET_free_non_null (backup_primary); | |
918 | n->state = S_DISCONNECT_FINISHED; | ||
919 | |||
920 | free_address (&n->primary_address); | ||
921 | free_address (&n->alternative_address); | ||
922 | 924 | ||
923 | GNUNET_assert (GNUNET_YES == | 925 | GNUNET_assert (GNUNET_YES == |
924 | GNUNET_CONTAINER_multihashmap_remove (neighbours, | 926 | GNUNET_CONTAINER_multihashmap_remove (neighbours, |