aboutsummaryrefslogtreecommitdiff
path: root/src/transport/gnunet-service-transport_neighbours.c
diff options
context:
space:
mode:
authorMatthias Wachs <wachs@net.in.tum.de>2013-01-14 11:14:33 +0000
committerMatthias Wachs <wachs@net.in.tum.de>2013-01-14 11:14:33 +0000
commit63fea7a7ae71c9a8d549711553532955e4200cc5 (patch)
treed0ead5ea0837c5ca48c01b443953d35c918170bd /src/transport/gnunet-service-transport_neighbours.c
parentbd914712dbe5fa19e74dd58ed676830767ea393f (diff)
downloadgnunet-63fea7a7ae71c9a8d549711553532955e4200cc5.tar.gz
gnunet-63fea7a7ae71c9a8d549711553532955e4200cc5.zip
fixing mantis 0002732
Diffstat (limited to 'src/transport/gnunet-service-transport_neighbours.c')
-rw-r--r--src/transport/gnunet-service-transport_neighbours.c29
1 files changed, 19 insertions, 10 deletions
diff --git a/src/transport/gnunet-service-transport_neighbours.c b/src/transport/gnunet-service-transport_neighbours.c
index 047f13144..04c455dfd 100644
--- a/src/transport/gnunet-service-transport_neighbours.c
+++ b/src/transport/gnunet-service-transport_neighbours.c
@@ -657,6 +657,11 @@ struct NeighbourMapEntry
657 struct GNUNET_TIME_Absolute connect_ack_timestamp; 657 struct GNUNET_TIME_Absolute connect_ack_timestamp;
658 658
659 /** 659 /**
660 * ATS address suggest handle
661 */
662 struct GNUNET_ATS_SuggestHandle *suggest_handle;
663
664 /**
660 * Time where we should cut the connection (timeout) if we don't 665 * Time where we should cut the connection (timeout) if we don't
661 * make progress in the state machine (or get a KEEPALIVE_RESPONSE 666 * make progress in the state machine (or get a KEEPALIVE_RESPONSE
662 * if we are in S_CONNECTED). 667 * if we are in S_CONNECTED).
@@ -1090,7 +1095,11 @@ free_neighbour (struct NeighbourMapEntry *n, int keep_sessions)
1090 // which states we do this from in the future (ATS should 1095 // which states we do this from in the future (ATS should
1091 // have given us a 'suggest_address' handle, and if we have 1096 // have given us a 'suggest_address' handle, and if we have
1092 // such a handle, we should cancel the operation here! 1097 // such a handle, we should cancel the operation here!
1093 GNUNET_ATS_suggest_address_cancel (GST_ats, &n->id); 1098 if (NULL != n->suggest_handle)
1099 {
1100 GNUNET_ATS_suggest_address_cancel (GST_ats, &n->id);
1101 n->suggest_handle = NULL;
1102 }
1094 1103
1095 if (GNUNET_SCHEDULER_NO_TASK != n->task) 1104 if (GNUNET_SCHEDULER_NO_TASK != n->task)
1096 { 1105 {
@@ -1910,7 +1919,7 @@ GST_neighbours_try_connect (const struct GNUNET_PeerIdentity *target)
1910 n->timeout = GNUNET_TIME_relative_to_absolute (ATS_RESPONSE_TIMEOUT); 1919 n->timeout = GNUNET_TIME_relative_to_absolute (ATS_RESPONSE_TIMEOUT);
1911 1920
1912 GNUNET_ATS_reset_backoff (GST_ats, target); 1921 GNUNET_ATS_reset_backoff (GST_ats, target);
1913 GNUNET_ATS_suggest_address (GST_ats, target); 1922 n->suggest_handle = GNUNET_ATS_suggest_address (GST_ats, target);
1914} 1923}
1915 1924
1916 1925
@@ -1975,7 +1984,7 @@ handle_test_blacklist_cont (void *cls,
1975 n->state = S_INIT_ATS; 1984 n->state = S_INIT_ATS;
1976 n->timeout = GNUNET_TIME_relative_to_absolute (ATS_RESPONSE_TIMEOUT); 1985 n->timeout = GNUNET_TIME_relative_to_absolute (ATS_RESPONSE_TIMEOUT);
1977 // FIXME: do we need to ask ATS again for suggestions? 1986 // FIXME: do we need to ask ATS again for suggestions?
1978 GNUNET_ATS_suggest_address (GST_ats, &n->id); 1987 n->suggest_handle = GNUNET_ATS_suggest_address (GST_ats, &n->id);
1979 } 1988 }
1980 break; 1989 break;
1981 case S_CONNECT_SENT: 1990 case S_CONNECT_SENT:
@@ -2001,7 +2010,7 @@ handle_test_blacklist_cont (void *cls,
2001 n->state = S_CONNECT_RECV_ATS; 2010 n->state = S_CONNECT_RECV_ATS;
2002 n->timeout = GNUNET_TIME_relative_to_absolute (ATS_RESPONSE_TIMEOUT); 2011 n->timeout = GNUNET_TIME_relative_to_absolute (ATS_RESPONSE_TIMEOUT);
2003 GNUNET_ATS_reset_backoff (GST_ats, peer); 2012 GNUNET_ATS_reset_backoff (GST_ats, peer);
2004 GNUNET_ATS_suggest_address (GST_ats, peer); 2013 n->suggest_handle = GNUNET_ATS_suggest_address (GST_ats, peer);
2005 break; 2014 break;
2006 case S_CONNECT_RECV_ATS: 2015 case S_CONNECT_RECV_ATS:
2007 /* still waiting on ATS suggestion, don't care about blacklist */ 2016 /* still waiting on ATS suggestion, don't care about blacklist */
@@ -2030,7 +2039,7 @@ handle_test_blacklist_cont (void *cls,
2030 n->timeout = GNUNET_TIME_relative_to_absolute (ATS_RESPONSE_TIMEOUT); 2039 n->timeout = GNUNET_TIME_relative_to_absolute (ATS_RESPONSE_TIMEOUT);
2031 // FIXME: do we need to ask ATS again for suggestions? 2040 // FIXME: do we need to ask ATS again for suggestions?
2032 GNUNET_ATS_reset_backoff (GST_ats, peer); 2041 GNUNET_ATS_reset_backoff (GST_ats, peer);
2033 GNUNET_ATS_suggest_address (GST_ats, &n->id); 2042 n->suggest_handle = GNUNET_ATS_suggest_address (GST_ats, &n->id);
2034 } 2043 }
2035 break; 2044 break;
2036 case S_CONNECT_RECV_ACK: 2045 case S_CONNECT_RECV_ACK:
@@ -2075,7 +2084,7 @@ handle_test_blacklist_cont (void *cls,
2075 n->state = S_RECONNECT_ATS; 2084 n->state = S_RECONNECT_ATS;
2076 n->timeout = GNUNET_TIME_relative_to_absolute (ATS_RESPONSE_TIMEOUT); 2085 n->timeout = GNUNET_TIME_relative_to_absolute (ATS_RESPONSE_TIMEOUT);
2077 // FIXME: do we need to ask ATS again for suggestions? 2086 // FIXME: do we need to ask ATS again for suggestions?
2078 GNUNET_ATS_suggest_address (GST_ats, &n->id); 2087 n->suggest_handle = GNUNET_ATS_suggest_address (GST_ats, &n->id);
2079 } 2088 }
2080 break; 2089 break;
2081 case S_RECONNECT_SENT: 2090 case S_RECONNECT_SENT:
@@ -2286,7 +2295,7 @@ GST_neighbours_handle_connect (const struct GNUNET_MessageHeader *message,
2286 n = setup_neighbour (peer); 2295 n = setup_neighbour (peer);
2287 n->state = S_CONNECT_RECV_ATS; 2296 n->state = S_CONNECT_RECV_ATS;
2288 GNUNET_ATS_reset_backoff (GST_ats, peer); 2297 GNUNET_ATS_reset_backoff (GST_ats, peer);
2289 GNUNET_ATS_suggest_address (GST_ats, peer); 2298 n->suggest_handle = GNUNET_ATS_suggest_address (GST_ats, peer);
2290 break; 2299 break;
2291 case S_DISCONNECT_FINISHED: 2300 case S_DISCONNECT_FINISHED:
2292 /* should not be possible */ 2301 /* should not be possible */
@@ -2963,7 +2972,7 @@ GST_neighbours_session_terminated (const struct GNUNET_PeerIdentity *peer,
2963 n->state = S_INIT_ATS; 2972 n->state = S_INIT_ATS;
2964 n->timeout = GNUNET_TIME_relative_to_absolute (ATS_RESPONSE_TIMEOUT); 2973 n->timeout = GNUNET_TIME_relative_to_absolute (ATS_RESPONSE_TIMEOUT);
2965 // FIXME: need to ask ATS for suggestions again? 2974 // FIXME: need to ask ATS for suggestions again?
2966 GNUNET_ATS_suggest_address (GST_ats, &n->id); 2975 n->suggest_handle = GNUNET_ATS_suggest_address (GST_ats, &n->id);
2967 break; 2976 break;
2968 case S_CONNECT_RECV_BLACKLIST_INBOUND: 2977 case S_CONNECT_RECV_BLACKLIST_INBOUND:
2969 case S_CONNECT_RECV_ATS: 2978 case S_CONNECT_RECV_ATS:
@@ -2978,7 +2987,7 @@ GST_neighbours_session_terminated (const struct GNUNET_PeerIdentity *peer,
2978 n->state = S_RECONNECT_ATS; 2987 n->state = S_RECONNECT_ATS;
2979 n->timeout = GNUNET_TIME_relative_to_absolute (ATS_RESPONSE_TIMEOUT); 2988 n->timeout = GNUNET_TIME_relative_to_absolute (ATS_RESPONSE_TIMEOUT);
2980 /* FIXME: is this ATS call needed? */ 2989 /* FIXME: is this ATS call needed? */
2981 GNUNET_ATS_suggest_address (GST_ats, &n->id); 2990 n->suggest_handle = GNUNET_ATS_suggest_address (GST_ats, &n->id);
2982 break; 2991 break;
2983 case S_RECONNECT_ATS: 2992 case S_RECONNECT_ATS:
2984 /* we don't have an address, how can it go down? */ 2993 /* we don't have an address, how can it go down? */
@@ -2989,7 +2998,7 @@ GST_neighbours_session_terminated (const struct GNUNET_PeerIdentity *peer,
2989 n->state = S_RECONNECT_ATS; 2998 n->state = S_RECONNECT_ATS;
2990 n->timeout = GNUNET_TIME_relative_to_absolute (ATS_RESPONSE_TIMEOUT); 2999 n->timeout = GNUNET_TIME_relative_to_absolute (ATS_RESPONSE_TIMEOUT);
2991 // FIXME: need to ask ATS for suggestions again? 3000 // FIXME: need to ask ATS for suggestions again?
2992 GNUNET_ATS_suggest_address (GST_ats, &n->id); 3001 n->suggest_handle = GNUNET_ATS_suggest_address (GST_ats, &n->id);
2993 break; 3002 break;
2994 case S_CONNECTED_SWITCHING_BLACKLIST: 3003 case S_CONNECTED_SWITCHING_BLACKLIST:
2995 /* primary went down while we were checking secondary against 3004 /* primary went down while we were checking secondary against