diff options
author | Matthias Wachs <wachs@net.in.tum.de> | 2012-06-29 16:43:11 +0000 |
---|---|---|
committer | Matthias Wachs <wachs@net.in.tum.de> | 2012-06-29 16:43:11 +0000 |
commit | 550d51f9db6905f0a28113b075020109fe38b6f0 (patch) | |
tree | ac3db5679b7f9ac522bd7f19bfcc28c490cac711 /src/transport/gnunet-service-transport_neighbours.c | |
parent | 20bef67d7b8a216bd2ebaafb30dbb19770e549c2 (diff) | |
download | gnunet-550d51f9db6905f0a28113b075020109fe38b6f0.tar.gz gnunet-550d51f9db6905f0a28113b075020109fe38b6f0.zip |
fix for mantis 2445
Diffstat (limited to 'src/transport/gnunet-service-transport_neighbours.c')
-rw-r--r-- | src/transport/gnunet-service-transport_neighbours.c | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/src/transport/gnunet-service-transport_neighbours.c b/src/transport/gnunet-service-transport_neighbours.c index 71245d493..1c693fd4a 100644 --- a/src/transport/gnunet-service-transport_neighbours.c +++ b/src/transport/gnunet-service-transport_neighbours.c | |||
@@ -870,6 +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 | 874 | ||
874 | n->is_active = NULL; /* always free'd by its own continuation! */ | 875 | n->is_active = NULL; /* always free'd by its own continuation! */ |
875 | 876 | ||
@@ -892,6 +893,12 @@ free_neighbour (struct NeighbourMapEntry *n, int keep_sessions) | |||
892 | disconnect_notify_cb (callback_cls, &n->id); | 893 | disconnect_notify_cb (callback_cls, &n->id); |
893 | } | 894 | } |
894 | 895 | ||
896 | |||
897 | /* cut transport-level connection */ | ||
898 | old_address = GNUNET_HELLO_address_copy(n->primary_address.address); | ||
899 | free_address (&n->primary_address); | ||
900 | free_address (&n->alternative_address); | ||
901 | |||
895 | /* FIXME-PLUGIN-API: This does not seem to guarantee that all | 902 | /* FIXME-PLUGIN-API: This does not seem to guarantee that all |
896 | transport sessions eventually get killed due to inactivity; they | 903 | transport sessions eventually get killed due to inactivity; they |
897 | MUST have their own timeout logic (but at least TCP doesn't have | 904 | MUST have their own timeout logic (but at least TCP doesn't have |
@@ -901,21 +908,20 @@ free_neighbour (struct NeighbourMapEntry *n, int keep_sessions) | |||
901 | API gives us not even the means to selectively kill only one of | 908 | API gives us not even the means to selectively kill only one of |
902 | them! Killing all sessions like this seems to be very, very | 909 | them! Killing all sessions like this seems to be very, very |
903 | wrong. */ | 910 | wrong. */ |
911 | |||
904 | if ((GNUNET_NO == keep_sessions) && | 912 | if ((GNUNET_NO == keep_sessions) && |
905 | (NULL != n->primary_address.address) && | 913 | (NULL != old_address) && |
906 | (NULL != (papi = GST_plugins_find (n->primary_address.address->transport_name)))) | 914 | (NULL != (papi = GST_plugins_find (old_address->transport_name)))) |
907 | papi->disconnect (papi->cls, &n->id); | 915 | papi->disconnect (papi->cls, &n->id); |
908 | 916 | ||
917 | GNUNET_free (old_address); | ||
918 | |||
909 | n->state = S_DISCONNECT_FINISHED; | 919 | n->state = S_DISCONNECT_FINISHED; |
910 | 920 | ||
911 | GNUNET_assert (GNUNET_YES == | 921 | GNUNET_assert (GNUNET_YES == |
912 | GNUNET_CONTAINER_multihashmap_remove (neighbours, | 922 | GNUNET_CONTAINER_multihashmap_remove (neighbours, |
913 | &n->id.hashPubKey, n)); | 923 | &n->id.hashPubKey, n)); |
914 | 924 | ||
915 | /* cut transport-level connection */ | ||
916 | free_address (&n->primary_address); | ||
917 | free_address (&n->alternative_address); | ||
918 | |||
919 | // FIXME-ATS-API: we might want to be more specific about | 925 | // FIXME-ATS-API: we might want to be more specific about |
920 | // which states we do this from in the future (ATS should | 926 | // which states we do this from in the future (ATS should |
921 | // have given us a 'suggest_address' handle, and if we have | 927 | // have given us a 'suggest_address' handle, and if we have |