diff options
author | Christian Grothoff <christian@grothoff.org> | 2015-02-03 14:11:03 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2015-02-03 14:11:03 +0000 |
commit | b2e99dd91c01b5fcc16b3b1031df897aeec05eef (patch) | |
tree | 31caea8a19fd943f8a9f7f7f3c19e52e11d95a77 /src/transport | |
parent | 55cecdea8638fa23c68e7ade7a8d5629da658f9e (diff) | |
download | gnunet-b2e99dd91c01b5fcc16b3b1031df897aeec05eef.tar.gz gnunet-b2e99dd91c01b5fcc16b3b1031df897aeec05eef.zip |
separate ATS connectivity suggestions from ATS scheduling API
Diffstat (limited to 'src/transport')
-rw-r--r-- | src/transport/gnunet-service-transport.c | 10 | ||||
-rw-r--r-- | src/transport/gnunet-service-transport.h | 5 | ||||
-rw-r--r-- | src/transport/gnunet-service-transport_neighbours.c | 14 |
3 files changed, 22 insertions, 7 deletions
diff --git a/src/transport/gnunet-service-transport.c b/src/transport/gnunet-service-transport.c index 2f0a17360..e65af664c 100644 --- a/src/transport/gnunet-service-transport.c +++ b/src/transport/gnunet-service-transport.c | |||
@@ -122,11 +122,16 @@ static struct GNUNET_SERVER_Handle *GST_server; | |||
122 | struct GNUNET_CRYPTO_EddsaPrivateKey *GST_my_private_key; | 122 | struct GNUNET_CRYPTO_EddsaPrivateKey *GST_my_private_key; |
123 | 123 | ||
124 | /** | 124 | /** |
125 | * ATS handle. | 125 | * ATS scheduling handle. |
126 | */ | 126 | */ |
127 | struct GNUNET_ATS_SchedulingHandle *GST_ats; | 127 | struct GNUNET_ATS_SchedulingHandle *GST_ats; |
128 | 128 | ||
129 | /** | 129 | /** |
130 | * ATS connectivity handle. | ||
131 | */ | ||
132 | struct GNUNET_ATS_ConnectivityHandle *GST_ats_connect; | ||
133 | |||
134 | /** | ||
130 | * Hello address expiration | 135 | * Hello address expiration |
131 | */ | 136 | */ |
132 | struct GNUNET_TIME_Relative hello_expiration; | 137 | struct GNUNET_TIME_Relative hello_expiration; |
@@ -857,6 +862,8 @@ shutdown_task (void *cls, | |||
857 | GST_ats_done (); | 862 | GST_ats_done (); |
858 | GNUNET_ATS_scheduling_done (GST_ats); | 863 | GNUNET_ATS_scheduling_done (GST_ats); |
859 | GST_ats = NULL; | 864 | GST_ats = NULL; |
865 | GNUNET_ATS_connectivity_done (GST_ats_connect); | ||
866 | GST_ats_connect = NULL; | ||
860 | GST_clients_stop (); | 867 | GST_clients_stop (); |
861 | GST_blacklist_stop (); | 868 | GST_blacklist_stop (); |
862 | GST_hello_stop (); | 869 | GST_hello_stop (); |
@@ -986,6 +993,7 @@ run (void *cls, | |||
986 | GST_hello_start (friend_only, &process_hello_update, NULL ); | 993 | GST_hello_start (friend_only, &process_hello_update, NULL ); |
987 | GNUNET_assert(NULL != GST_hello_get()); | 994 | GNUNET_assert(NULL != GST_hello_get()); |
988 | GST_blacklist_start (GST_server, GST_cfg, &GST_my_identity); | 995 | GST_blacklist_start (GST_server, GST_cfg, &GST_my_identity); |
996 | GST_ats_connect = GNUNET_ATS_connectivity_init (GST_cfg); | ||
989 | GST_ats = GNUNET_ATS_scheduling_init (GST_cfg, | 997 | GST_ats = GNUNET_ATS_scheduling_init (GST_cfg, |
990 | &ats_request_address_change, | 998 | &ats_request_address_change, |
991 | NULL); | 999 | NULL); |
diff --git a/src/transport/gnunet-service-transport.h b/src/transport/gnunet-service-transport.h index 350ae5b6c..f60f18692 100644 --- a/src/transport/gnunet-service-transport.h +++ b/src/transport/gnunet-service-transport.h | |||
@@ -63,6 +63,11 @@ extern struct GNUNET_CRYPTO_EddsaPrivateKey *GST_my_private_key; | |||
63 | */ | 63 | */ |
64 | extern struct GNUNET_ATS_SchedulingHandle *GST_ats; | 64 | extern struct GNUNET_ATS_SchedulingHandle *GST_ats; |
65 | 65 | ||
66 | /** | ||
67 | * ATS connectivity handle. | ||
68 | */ | ||
69 | extern struct GNUNET_ATS_ConnectivityHandle *GST_ats_connect; | ||
70 | |||
66 | 71 | ||
67 | /** | 72 | /** |
68 | * Function to call when a peer's address has changed | 73 | * Function to call when a peer's address has changed |
diff --git a/src/transport/gnunet-service-transport_neighbours.c b/src/transport/gnunet-service-transport_neighbours.c index bcbc4601e..49b026e7a 100644 --- a/src/transport/gnunet-service-transport_neighbours.c +++ b/src/transport/gnunet-service-transport_neighbours.c | |||
@@ -373,7 +373,7 @@ struct NeighbourMapEntry | |||
373 | /** | 373 | /** |
374 | * ATS address suggest handle | 374 | * ATS address suggest handle |
375 | */ | 375 | */ |
376 | struct GNUNET_ATS_SuggestHandle *suggest_handle; | 376 | struct GNUNET_ATS_ConnectivitySuggestHandle *suggest_handle; |
377 | 377 | ||
378 | /** | 378 | /** |
379 | * Time where we should cut the connection (timeout) if we don't | 379 | * Time where we should cut the connection (timeout) if we don't |
@@ -1047,7 +1047,7 @@ free_neighbour (struct NeighbourMapEntry *n, | |||
1047 | /* Cancel address requests for this peer */ | 1047 | /* Cancel address requests for this peer */ |
1048 | if (NULL != n->suggest_handle) | 1048 | if (NULL != n->suggest_handle) |
1049 | { | 1049 | { |
1050 | GNUNET_ATS_suggest_address_cancel (GST_ats, &n->id); | 1050 | GNUNET_ATS_connectivity_suggest_cancel (n->suggest_handle); |
1051 | n->suggest_handle = NULL; | 1051 | n->suggest_handle = NULL; |
1052 | } | 1052 | } |
1053 | 1053 | ||
@@ -2173,8 +2173,8 @@ try_connect_bl_check_cont (void *cls, | |||
2173 | GNUNET_TIME_relative_to_absolute (ATS_RESPONSE_TIMEOUT)); | 2173 | GNUNET_TIME_relative_to_absolute (ATS_RESPONSE_TIMEOUT)); |
2174 | GNUNET_ATS_reset_backoff (GST_ats, peer); | 2174 | GNUNET_ATS_reset_backoff (GST_ats, peer); |
2175 | GNUNET_assert (NULL == n->suggest_handle); | 2175 | GNUNET_assert (NULL == n->suggest_handle); |
2176 | n->suggest_handle = GNUNET_ATS_suggest_address (GST_ats, | 2176 | n->suggest_handle = GNUNET_ATS_connectivity_suggest (GST_ats_connect, |
2177 | peer); | 2177 | peer); |
2178 | } | 2178 | } |
2179 | 2179 | ||
2180 | 2180 | ||
@@ -2321,7 +2321,8 @@ GST_neighbours_handle_session_syn (const struct GNUNET_MessageHeader *message, | |||
2321 | set_state_and_timeout (n, GNUNET_TRANSPORT_PS_SYN_RECV_ATS, | 2321 | set_state_and_timeout (n, GNUNET_TRANSPORT_PS_SYN_RECV_ATS, |
2322 | GNUNET_TIME_relative_to_absolute (ATS_RESPONSE_TIMEOUT)); | 2322 | GNUNET_TIME_relative_to_absolute (ATS_RESPONSE_TIMEOUT)); |
2323 | if (NULL == n->suggest_handle) | 2323 | if (NULL == n->suggest_handle) |
2324 | n->suggest_handle = GNUNET_ATS_suggest_address (GST_ats, peer); | 2324 | n->suggest_handle = GNUNET_ATS_connectivity_suggest (GST_ats_connect, |
2325 | peer); | ||
2325 | break; | 2326 | break; |
2326 | case GNUNET_TRANSPORT_PS_INIT_ATS: | 2327 | case GNUNET_TRANSPORT_PS_INIT_ATS: |
2327 | /* SYN message takes priority over us asking ATS for address: | 2328 | /* SYN message takes priority over us asking ATS for address: |
@@ -2375,7 +2376,8 @@ GST_neighbours_handle_session_syn (const struct GNUNET_MessageHeader *message, | |||
2375 | n->ack_state = ACK_SEND_SYN_ACK; | 2376 | n->ack_state = ACK_SEND_SYN_ACK; |
2376 | n->connect_ack_timestamp = ts; | 2377 | n->connect_ack_timestamp = ts; |
2377 | /* Request an address for the peer */ | 2378 | /* Request an address for the peer */ |
2378 | n->suggest_handle = GNUNET_ATS_suggest_address (GST_ats, peer); | 2379 | n->suggest_handle = GNUNET_ATS_connectivity_suggest (GST_ats_connect, |
2380 | peer); | ||
2379 | GNUNET_ATS_reset_backoff (GST_ats, peer); | 2381 | GNUNET_ATS_reset_backoff (GST_ats, peer); |
2380 | set_state (n, GNUNET_TRANSPORT_PS_SYN_RECV_ATS); | 2382 | set_state (n, GNUNET_TRANSPORT_PS_SYN_RECV_ATS); |
2381 | break; | 2383 | break; |