aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMatthias Wachs <wachs@net.in.tum.de>2012-06-18 09:07:38 +0000
committerMatthias Wachs <wachs@net.in.tum.de>2012-06-18 09:07:38 +0000
commit3bea1b11de57b46ba7a5b360b7c8e5dc0565edbb (patch)
tree1e9366b8ccce16e5037b8518e5e3c4f9190deeae /src
parentad8abc8cb6c635f2687bbff83ad43a9dbb821bc6 (diff)
downloadgnunet-3bea1b11de57b46ba7a5b360b7c8e5dc0565edbb.tar.gz
gnunet-3bea1b11de57b46ba7a5b360b7c8e5dc0565edbb.zip
-fix
Diffstat (limited to 'src')
-rw-r--r--src/transport/gnunet-service-transport.c10
-rw-r--r--src/transport/gnunet-service-transport_neighbours.c16
-rw-r--r--src/transport/gnunet-service-transport_neighbours.h4
3 files changed, 21 insertions, 9 deletions
diff --git a/src/transport/gnunet-service-transport.c b/src/transport/gnunet-service-transport.c
index 1714229b5..b2b59c8e2 100644
--- a/src/transport/gnunet-service-transport.c
+++ b/src/transport/gnunet-service-transport.c
@@ -339,6 +339,7 @@ plugin_env_session_end (void *cls, const struct GNUNET_PeerIdentity *peer,
339{ 339{
340 const char *transport_name = cls; 340 const char *transport_name = cls;
341 struct GNUNET_HELLO_Address address; 341 struct GNUNET_HELLO_Address address;
342 int ret;
342 343
343 GNUNET_assert (strlen (transport_name) > 0); 344 GNUNET_assert (strlen (transport_name) > 0);
344 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Session %p to peer `%s' ended \n", 345 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Session %p to peer `%s' ended \n",
@@ -352,8 +353,13 @@ plugin_env_session_end (void *cls, const struct GNUNET_PeerIdentity *peer,
352 address.address = NULL; 353 address.address = NULL;
353 address.address_length = 0; 354 address.address_length = 0;
354 address.transport_name = transport_name; 355 address.transport_name = transport_name;
355 GST_neighbours_session_terminated (peer, session); 356 ret = GST_neighbours_session_terminated (peer, session);
356 GNUNET_ATS_address_destroyed (GST_ats, &address, session); 357 if (GNUNET_NO == ret)
358 {
359 /* This was a session currently not used by
360 * neighbours so we have to destroy it here */
361 GNUNET_ATS_address_destroyed (GST_ats, &address, session);
362 }
357} 363}
358 364
359 365
diff --git a/src/transport/gnunet-service-transport_neighbours.c b/src/transport/gnunet-service-transport_neighbours.c
index 44b9338ad..78e160fa0 100644
--- a/src/transport/gnunet-service-transport_neighbours.c
+++ b/src/transport/gnunet-service-transport_neighbours.c
@@ -766,6 +766,7 @@ free_address (struct NeighbourAddress *na)
766 { 766 {
767 GST_validation_set_address_use (na->address, na->session, GNUNET_NO, __LINE__); 767 GST_validation_set_address_use (na->address, na->session, GNUNET_NO, __LINE__);
768 GNUNET_ATS_address_in_use (GST_ats, na->address, na->session, GNUNET_NO); 768 GNUNET_ATS_address_in_use (GST_ats, na->address, na->session, GNUNET_NO);
769 GNUNET_ATS_address_destroyed (GST_ats, na->address, na->session);
769 } 770 }
770 na->ats_active = GNUNET_NO; 771 na->ats_active = GNUNET_NO;
771 if (NULL != na->address) 772 if (NULL != na->address)
@@ -2681,8 +2682,10 @@ GST_neighbours_handle_connect_ack (const struct GNUNET_MessageHeader *message,
2681 * 2682 *
2682 * @param peer identity of the peer where the session died 2683 * @param peer identity of the peer where the session died
2683 * @param session session that is gone 2684 * @param session session that is gone
2685 * @param GNUNET_YES if this was a session used, GNUNET_NO if
2686 * this session was not in use
2684 */ 2687 */
2685void 2688int
2686GST_neighbours_session_terminated (const struct GNUNET_PeerIdentity *peer, 2689GST_neighbours_session_terminated (const struct GNUNET_PeerIdentity *peer,
2687 struct Session *session) 2690 struct Session *session)
2688{ 2691{
@@ -2706,7 +2709,7 @@ GST_neighbours_session_terminated (const struct GNUNET_PeerIdentity *peer,
2706 } 2709 }
2707 } 2710 }
2708 if (NULL == (n = lookup_neighbour (peer))) 2711 if (NULL == (n = lookup_neighbour (peer)))
2709 return; /* can't affect us */ 2712 return GNUNET_NO; /* can't affect us */
2710 if (session != n->primary_address.session) 2713 if (session != n->primary_address.session)
2711 { 2714 {
2712 if (session == n->alternative_address.session) 2715 if (session == n->alternative_address.session)
@@ -2718,7 +2721,7 @@ GST_neighbours_session_terminated (const struct GNUNET_PeerIdentity *peer,
2718 else 2721 else
2719 GNUNET_break (0); 2722 GNUNET_break (0);
2720 } 2723 }
2721 return; /* doesn't affect us further */ 2724 return GNUNET_NO; /* doesn't affect us further */
2722 } 2725 }
2723 2726
2724 n->expect_latency_response = GNUNET_NO; 2727 n->expect_latency_response = GNUNET_NO;
@@ -2727,11 +2730,11 @@ GST_neighbours_session_terminated (const struct GNUNET_PeerIdentity *peer,
2727 case S_NOT_CONNECTED: 2730 case S_NOT_CONNECTED:
2728 GNUNET_break (0); 2731 GNUNET_break (0);
2729 free_neighbour (n, GNUNET_NO); 2732 free_neighbour (n, GNUNET_NO);
2730 return; 2733 return GNUNET_YES;
2731 case S_INIT_ATS: 2734 case S_INIT_ATS:
2732 GNUNET_break (0); 2735 GNUNET_break (0);
2733 free_neighbour (n, GNUNET_NO); 2736 free_neighbour (n, GNUNET_NO);
2734 return; 2737 return GNUNET_YES;
2735 case S_INIT_BLACKLIST: 2738 case S_INIT_BLACKLIST:
2736 case S_CONNECT_SENT: 2739 case S_CONNECT_SENT:
2737 free_address (&n->primary_address); 2740 free_address (&n->primary_address);
@@ -2747,7 +2750,7 @@ GST_neighbours_session_terminated (const struct GNUNET_PeerIdentity *peer,
2747 /* error on inbound session; free neighbour entirely */ 2750 /* error on inbound session; free neighbour entirely */
2748 free_address (&n->primary_address); 2751 free_address (&n->primary_address);
2749 free_neighbour (n, GNUNET_NO); 2752 free_neighbour (n, GNUNET_NO);
2750 return; 2753 return GNUNET_YES;
2751 case S_CONNECTED: 2754 case S_CONNECTED:
2752 free_address (&n->primary_address); 2755 free_address (&n->primary_address);
2753 n->state = S_RECONNECT_ATS; 2756 n->state = S_RECONNECT_ATS;
@@ -2798,6 +2801,7 @@ GST_neighbours_session_terminated (const struct GNUNET_PeerIdentity *peer,
2798 if (GNUNET_SCHEDULER_NO_TASK != n->task) 2801 if (GNUNET_SCHEDULER_NO_TASK != n->task)
2799 GNUNET_SCHEDULER_cancel (n->task); 2802 GNUNET_SCHEDULER_cancel (n->task);
2800 n->task = GNUNET_SCHEDULER_add_now (&master_task, n); 2803 n->task = GNUNET_SCHEDULER_add_now (&master_task, n);
2804 return GNUNET_YES;
2801} 2805}
2802 2806
2803 2807
diff --git a/src/transport/gnunet-service-transport_neighbours.h b/src/transport/gnunet-service-transport_neighbours.h
index 23091b750..c53f1a457 100644
--- a/src/transport/gnunet-service-transport_neighbours.h
+++ b/src/transport/gnunet-service-transport_neighbours.h
@@ -195,8 +195,10 @@ GST_neighbours_iterate (GST_NeighbourIterator cb, void *cb_cls);
195 * 195 *
196 * @param peer identity of the peer where the session died 196 * @param peer identity of the peer where the session died
197 * @param session session that is gone 197 * @param session session that is gone
198 * @param GNUNET_YES if this was a session used, GNUNET_NO if
199 * this session was not in use
198 */ 200 */
199void 201int
200GST_neighbours_session_terminated (const struct GNUNET_PeerIdentity *peer, 202GST_neighbours_session_terminated (const struct GNUNET_PeerIdentity *peer,
201 struct Session *session); 203 struct Session *session);
202 204