diff options
25 files changed, 117 insertions, 37 deletions
diff --git a/src/ats/ats_api_scheduling.c b/src/ats/ats_api_scheduling.c index 7750ad1cf..d23de8940 100644 --- a/src/ats/ats_api_scheduling.c +++ b/src/ats/ats_api_scheduling.c | |||
@@ -656,7 +656,9 @@ process_ats_message (void *cls, const struct GNUNET_MessageHeader *msg) | |||
656 | return; | 656 | return; |
657 | } | 657 | } |
658 | 658 | ||
659 | sh->suggest_cb (sh->suggest_cb_cls, &address, s, m->bandwidth_out, | 659 | sh->suggest_cb (sh->suggest_cb_cls, |
660 | (const struct GNUNET_PeerIdentity *) &m->peer, | ||
661 | &address, s, m->bandwidth_out, | ||
660 | m->bandwidth_in, atsi, ats_count); | 662 | m->bandwidth_in, atsi, ats_count); |
661 | 663 | ||
662 | GNUNET_CLIENT_receive (sh->client, &process_ats_message, sh, | 664 | GNUNET_CLIENT_receive (sh->client, &process_ats_message, sh, |
@@ -1055,16 +1057,23 @@ GNUNET_ATS_reset_backoff (struct GNUNET_ATS_SchedulingHandle *sh, | |||
1055 | } | 1057 | } |
1056 | 1058 | ||
1057 | /** | 1059 | /** |
1058 | * We would like to establish a new connection with a peer. ATS | 1060 | * We would like to receive address suggestions for a peer. ATS will |
1059 | * should suggest a good address to begin with. | 1061 | * respond with a call to the continuation immediately containing an address or |
1062 | * no address if none is available. ATS can suggest more addresses until we call | ||
1063 | * #GNUNET_ATS_suggest_address_cancel. | ||
1064 | * | ||
1060 | * | 1065 | * |
1061 | * @param sh handle | 1066 | * @param sh handle |
1062 | * @param peer identity of the peer we need an address for | 1067 | * @param peer identity of the peer we need an address for |
1068 | * @param cont the continuation to call with the address | ||
1069 | * @param cont_cls the cls for the continuation | ||
1063 | * @return suggest handle | 1070 | * @return suggest handle |
1064 | */ | 1071 | */ |
1065 | struct GNUNET_ATS_SuggestHandle * | 1072 | struct GNUNET_ATS_SuggestHandle * |
1066 | GNUNET_ATS_suggest_address (struct GNUNET_ATS_SchedulingHandle *sh, | 1073 | GNUNET_ATS_suggest_address (struct GNUNET_ATS_SchedulingHandle *sh, |
1067 | const struct GNUNET_PeerIdentity *peer) | 1074 | const struct GNUNET_PeerIdentity *peer, |
1075 | GNUNET_ATS_AddressSuggestionCallback cont, | ||
1076 | void *cont_cls) | ||
1068 | { | 1077 | { |
1069 | struct PendingMessage *p; | 1078 | struct PendingMessage *p; |
1070 | struct RequestAddressMessage *m; | 1079 | struct RequestAddressMessage *m; |
diff --git a/src/ats/test_ats_api_performance_list_all_addresses.c b/src/ats/test_ats_api_performance_list_all_addresses.c index c02177cac..4512739e1 100644 --- a/src/ats/test_ats_api_performance_list_all_addresses.c +++ b/src/ats/test_ats_api_performance_list_all_addresses.c | |||
@@ -146,7 +146,9 @@ stat_cb(void *cls, const char *subsystem, | |||
146 | } | 146 | } |
147 | 147 | ||
148 | static void | 148 | static void |
149 | address_suggest_cb (void *cls, const struct GNUNET_HELLO_Address *address, | 149 | address_suggest_cb (void *cls, |
150 | const struct GNUNET_PeerIdentity *peer, | ||
151 | const struct GNUNET_HELLO_Address *address, | ||
150 | struct Session *session, | 152 | struct Session *session, |
151 | struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out, | 153 | struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out, |
152 | struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in, | 154 | struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in, |
diff --git a/src/ats/test_ats_api_performance_list_all_addresses_active.c b/src/ats/test_ats_api_performance_list_all_addresses_active.c index 21cedb897..5cc4d4c65 100644 --- a/src/ats/test_ats_api_performance_list_all_addresses_active.c +++ b/src/ats/test_ats_api_performance_list_all_addresses_active.c | |||
@@ -154,7 +154,9 @@ stat_cb(void *cls, const char *subsystem, | |||
154 | } | 154 | } |
155 | 155 | ||
156 | static void | 156 | static void |
157 | address_suggest_cb (void *cls, const struct GNUNET_HELLO_Address *address, | 157 | address_suggest_cb (void *cls, |
158 | const struct GNUNET_PeerIdentity *peer, | ||
159 | const struct GNUNET_HELLO_Address *address, | ||
158 | struct Session *session, | 160 | struct Session *session, |
159 | struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out, | 161 | struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out, |
160 | struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in, | 162 | struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in, |
diff --git a/src/ats/test_ats_api_performance_list_peer_addresses.c b/src/ats/test_ats_api_performance_list_peer_addresses.c index 70f2f711d..1f64a6ae9 100644 --- a/src/ats/test_ats_api_performance_list_peer_addresses.c +++ b/src/ats/test_ats_api_performance_list_peer_addresses.c | |||
@@ -155,7 +155,9 @@ stat_cb(void *cls, const char *subsystem, | |||
155 | } | 155 | } |
156 | 156 | ||
157 | static void | 157 | static void |
158 | address_suggest_cb (void *cls, const struct GNUNET_HELLO_Address *address, | 158 | address_suggest_cb (void *cls, |
159 | const struct GNUNET_PeerIdentity *peer, | ||
160 | const struct GNUNET_HELLO_Address *address, | ||
159 | struct Session *session, | 161 | struct Session *session, |
160 | struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out, | 162 | struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out, |
161 | struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in, | 163 | struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in, |
diff --git a/src/ats/test_ats_api_performance_monitor.c b/src/ats/test_ats_api_performance_monitor.c index 887a139e8..6ccac45d1 100644 --- a/src/ats/test_ats_api_performance_monitor.c +++ b/src/ats/test_ats_api_performance_monitor.c | |||
@@ -144,12 +144,15 @@ stat_cb(void *cls, const char *subsystem, | |||
144 | } | 144 | } |
145 | 145 | ||
146 | static void | 146 | static void |
147 | address_suggest_cb (void *cls, const struct GNUNET_HELLO_Address *address, | 147 | address_suggest_cb (void *cls, |
148 | const struct GNUNET_PeerIdentity *peer, | ||
149 | const struct GNUNET_HELLO_Address *address, | ||
148 | struct Session *session, | 150 | struct Session *session, |
149 | struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out, | 151 | struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out, |
150 | struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in, | 152 | struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in, |
151 | const struct GNUNET_ATS_Information *atsi, | 153 | const struct GNUNET_ATS_Information *atsi, |
152 | uint32_t ats_count) | 154 | uint32_t ats_count) |
155 | |||
153 | { | 156 | { |
154 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Did not expect suggestion callback!\n"); | 157 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Did not expect suggestion callback!\n"); |
155 | GNUNET_SCHEDULER_add_now (&end_badly, NULL); | 158 | GNUNET_SCHEDULER_add_now (&end_badly, NULL); |
diff --git a/src/ats/test_ats_api_performance_monitor_initial_callback.c b/src/ats/test_ats_api_performance_monitor_initial_callback.c index 89fc06792..6d305d3a5 100644 --- a/src/ats/test_ats_api_performance_monitor_initial_callback.c +++ b/src/ats/test_ats_api_performance_monitor_initial_callback.c | |||
@@ -152,12 +152,15 @@ stat_cb(void *cls, const char *subsystem, | |||
152 | } | 152 | } |
153 | 153 | ||
154 | static void | 154 | static void |
155 | address_suggest_cb (void *cls, const struct GNUNET_HELLO_Address *address, | 155 | address_suggest_cb (void *cls, |
156 | const struct GNUNET_PeerIdentity *peer, | ||
157 | const struct GNUNET_HELLO_Address *address, | ||
156 | struct Session *session, | 158 | struct Session *session, |
157 | struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out, | 159 | struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out, |
158 | struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in, | 160 | struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in, |
159 | const struct GNUNET_ATS_Information *atsi, | 161 | const struct GNUNET_ATS_Information *atsi, |
160 | uint32_t ats_count) | 162 | uint32_t ats_count) |
163 | |||
161 | { | 164 | { |
162 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Did not expect suggestion callback!\n"); | 165 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Did not expect suggestion callback!\n"); |
163 | GNUNET_SCHEDULER_add_now (&end_badly, NULL); | 166 | GNUNET_SCHEDULER_add_now (&end_badly, NULL); |
diff --git a/src/ats/test_ats_api_scheduling_add_address.c b/src/ats/test_ats_api_scheduling_add_address.c index c12802293..332e46d19 100644 --- a/src/ats/test_ats_api_scheduling_add_address.c +++ b/src/ats/test_ats_api_scheduling_add_address.c | |||
@@ -136,7 +136,9 @@ end_badly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
136 | } | 136 | } |
137 | 137 | ||
138 | static void | 138 | static void |
139 | address_suggest_cb (void *cls, const struct GNUNET_HELLO_Address *address, | 139 | address_suggest_cb (void *cls, |
140 | const struct GNUNET_PeerIdentity *peer, | ||
141 | const struct GNUNET_HELLO_Address *address, | ||
140 | struct Session *session, | 142 | struct Session *session, |
141 | struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out, | 143 | struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out, |
142 | struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in, | 144 | struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in, |
diff --git a/src/ats/test_ats_api_scheduling_add_address_duplicate.c b/src/ats/test_ats_api_scheduling_add_address_duplicate.c index 0d2b8310d..f2c2b4fd6 100644 --- a/src/ats/test_ats_api_scheduling_add_address_duplicate.c +++ b/src/ats/test_ats_api_scheduling_add_address_duplicate.c | |||
@@ -147,12 +147,15 @@ end_badly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
147 | } | 147 | } |
148 | 148 | ||
149 | static void | 149 | static void |
150 | address_suggest_cb (void *cls, const struct GNUNET_HELLO_Address *address, | 150 | address_suggest_cb (void *cls, |
151 | const struct GNUNET_PeerIdentity *peer, | ||
152 | const struct GNUNET_HELLO_Address *address, | ||
151 | struct Session *session, | 153 | struct Session *session, |
152 | struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out, | 154 | struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out, |
153 | struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in, | 155 | struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in, |
154 | const struct GNUNET_ATS_Information *atsi, | 156 | const struct GNUNET_ATS_Information *atsi, |
155 | uint32_t ats_count) | 157 | uint32_t ats_count) |
158 | |||
156 | { | 159 | { |
157 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Did not expect suggestion callback!\n"); | 160 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Did not expect suggestion callback!\n"); |
158 | GNUNET_SCHEDULER_add_now (&end_badly, NULL); | 161 | GNUNET_SCHEDULER_add_now (&end_badly, NULL); |
diff --git a/src/ats/test_ats_api_scheduling_add_address_inbound.c b/src/ats/test_ats_api_scheduling_add_address_inbound.c index b5e3eb8b6..fb4ddd2da 100644 --- a/src/ats/test_ats_api_scheduling_add_address_inbound.c +++ b/src/ats/test_ats_api_scheduling_add_address_inbound.c | |||
@@ -142,7 +142,9 @@ end_badly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
142 | } | 142 | } |
143 | 143 | ||
144 | static void | 144 | static void |
145 | address_suggest_cb (void *cls, const struct GNUNET_HELLO_Address *address, | 145 | address_suggest_cb (void *cls, |
146 | const struct GNUNET_PeerIdentity *peer, | ||
147 | const struct GNUNET_HELLO_Address *address, | ||
146 | struct Session *session, | 148 | struct Session *session, |
147 | struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out, | 149 | struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out, |
148 | struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in, | 150 | struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in, |
diff --git a/src/ats/test_ats_api_scheduling_add_session.c b/src/ats/test_ats_api_scheduling_add_session.c index c415b57e2..9d7fd99d1 100644 --- a/src/ats/test_ats_api_scheduling_add_session.c +++ b/src/ats/test_ats_api_scheduling_add_session.c | |||
@@ -149,7 +149,9 @@ end_badly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
149 | } | 149 | } |
150 | 150 | ||
151 | static void | 151 | static void |
152 | address_suggest_cb (void *cls, const struct GNUNET_HELLO_Address *address, | 152 | address_suggest_cb (void *cls, |
153 | const struct GNUNET_PeerIdentity *peer, | ||
154 | const struct GNUNET_HELLO_Address *address, | ||
153 | struct Session *session, | 155 | struct Session *session, |
154 | struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out, | 156 | struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out, |
155 | struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in, | 157 | struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in, |
diff --git a/src/ats/test_ats_api_scheduling_destroy_address.c b/src/ats/test_ats_api_scheduling_destroy_address.c index d46872f6c..bc1b7bd83 100644 --- a/src/ats/test_ats_api_scheduling_destroy_address.c +++ b/src/ats/test_ats_api_scheduling_destroy_address.c | |||
@@ -147,7 +147,9 @@ end_badly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
147 | } | 147 | } |
148 | 148 | ||
149 | static void | 149 | static void |
150 | address_suggest_cb (void *cls, const struct GNUNET_HELLO_Address *address, | 150 | address_suggest_cb (void *cls, |
151 | const struct GNUNET_PeerIdentity *peer, | ||
152 | const struct GNUNET_HELLO_Address *address, | ||
151 | struct Session *session, | 153 | struct Session *session, |
152 | struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out, | 154 | struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out, |
153 | struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in, | 155 | struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in, |
diff --git a/src/ats/test_ats_api_scheduling_destroy_address_twice.c b/src/ats/test_ats_api_scheduling_destroy_address_twice.c index fd9dde179..9b34effd1 100644 --- a/src/ats/test_ats_api_scheduling_destroy_address_twice.c +++ b/src/ats/test_ats_api_scheduling_destroy_address_twice.c | |||
@@ -149,7 +149,9 @@ end_badly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
149 | } | 149 | } |
150 | 150 | ||
151 | static void | 151 | static void |
152 | address_suggest_cb (void *cls, const struct GNUNET_HELLO_Address *address, | 152 | address_suggest_cb (void *cls, |
153 | const struct GNUNET_PeerIdentity *peer, | ||
154 | const struct GNUNET_HELLO_Address *address, | ||
153 | struct Session *session, | 155 | struct Session *session, |
154 | struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out, | 156 | struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out, |
155 | struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in, | 157 | struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in, |
diff --git a/src/ats/test_ats_api_scheduling_destroy_session.c b/src/ats/test_ats_api_scheduling_destroy_session.c index 69d9b88a7..ae236ea32 100644 --- a/src/ats/test_ats_api_scheduling_destroy_session.c +++ b/src/ats/test_ats_api_scheduling_destroy_session.c | |||
@@ -153,7 +153,9 @@ end_badly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
153 | } | 153 | } |
154 | 154 | ||
155 | static void | 155 | static void |
156 | address_suggest_cb (void *cls, const struct GNUNET_HELLO_Address *address, | 156 | address_suggest_cb (void *cls, |
157 | const struct GNUNET_PeerIdentity *peer, | ||
158 | const struct GNUNET_HELLO_Address *address, | ||
157 | struct Session *session, | 159 | struct Session *session, |
158 | struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out, | 160 | struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out, |
159 | struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in, | 161 | struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in, |
diff --git a/src/ats/test_ats_api_scheduling_init.c b/src/ats/test_ats_api_scheduling_init.c index 3a75a7802..a7914d5c6 100644 --- a/src/ats/test_ats_api_scheduling_init.c +++ b/src/ats/test_ats_api_scheduling_init.c | |||
@@ -116,7 +116,9 @@ end_badly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
116 | } | 116 | } |
117 | 117 | ||
118 | static void | 118 | static void |
119 | address_suggest_cb (void *cls, const struct GNUNET_HELLO_Address *address, | 119 | address_suggest_cb (void *cls, |
120 | const struct GNUNET_PeerIdentity *peer, | ||
121 | const struct GNUNET_HELLO_Address *address, | ||
120 | struct Session *session, | 122 | struct Session *session, |
121 | struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out, | 123 | struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out, |
122 | struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in, | 124 | struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in, |
diff --git a/src/ats/test_ats_simplistic_pref_aging.c b/src/ats/test_ats_simplistic_pref_aging.c index f354ce1cc..c8485856c 100644 --- a/src/ats/test_ats_simplistic_pref_aging.c +++ b/src/ats/test_ats_simplistic_pref_aging.c | |||
@@ -144,7 +144,9 @@ end () | |||
144 | 144 | ||
145 | 145 | ||
146 | static void | 146 | static void |
147 | address_suggest_cb (void *cls, const struct GNUNET_HELLO_Address *address, | 147 | address_suggest_cb (void *cls, |
148 | const struct GNUNET_PeerIdentity *peer, | ||
149 | const struct GNUNET_HELLO_Address *address, | ||
148 | struct Session *session, | 150 | struct Session *session, |
149 | struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out, | 151 | struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out, |
150 | struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in, | 152 | struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in, |
diff --git a/src/ats/test_ats_solver_add_address.c b/src/ats/test_ats_solver_add_address.c index 571a38dc6..4cc37e812 100644 --- a/src/ats/test_ats_solver_add_address.c +++ b/src/ats/test_ats_solver_add_address.c | |||
@@ -129,7 +129,9 @@ end_badly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
129 | } | 129 | } |
130 | 130 | ||
131 | static void | 131 | static void |
132 | address_suggest_cb (void *cls, const struct GNUNET_HELLO_Address *address, | 132 | address_suggest_cb (void *cls, |
133 | const struct GNUNET_PeerIdentity *peer, | ||
134 | const struct GNUNET_HELLO_Address *address, | ||
133 | struct Session *session, | 135 | struct Session *session, |
134 | struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out, | 136 | struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out, |
135 | struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in, | 137 | struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in, |
diff --git a/src/ats/test_ats_solver_add_address_and_request.c b/src/ats/test_ats_solver_add_address_and_request.c index e761385cf..55a7469e7 100644 --- a/src/ats/test_ats_solver_add_address_and_request.c +++ b/src/ats/test_ats_solver_add_address_and_request.c | |||
@@ -128,7 +128,9 @@ end_badly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
128 | } | 128 | } |
129 | 129 | ||
130 | static void | 130 | static void |
131 | address_suggest_cb (void *cls, const struct GNUNET_HELLO_Address *address, | 131 | address_suggest_cb (void *cls, |
132 | const struct GNUNET_PeerIdentity *peer, | ||
133 | const struct GNUNET_HELLO_Address *address, | ||
132 | struct Session *session, | 134 | struct Session *session, |
133 | struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out, | 135 | struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out, |
134 | struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in, | 136 | struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in, |
@@ -157,7 +159,7 @@ stat_cb(void *cls, const char *subsystem, | |||
157 | 159 | ||
158 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, "ATS statistics: `%s' `%s' %llu\n", | 160 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, "ATS statistics: `%s' `%s' %llu\n", |
159 | subsystem,name, value); | 161 | subsystem,name, value); |
160 | GNUNET_ATS_suggest_address (sched_ats, &p.id); | 162 | GNUNET_ATS_suggest_address (sched_ats, &p.id, NULL, NULL); |
161 | return GNUNET_OK; | 163 | return GNUNET_OK; |
162 | } | 164 | } |
163 | 165 | ||
diff --git a/src/ats/test_ats_solver_alternative_after_delete_address.c b/src/ats/test_ats_solver_alternative_after_delete_address.c index 02a8b79c8..3bd038799 100644 --- a/src/ats/test_ats_solver_alternative_after_delete_address.c +++ b/src/ats/test_ats_solver_alternative_after_delete_address.c | |||
@@ -167,7 +167,9 @@ end_badly_now () | |||
167 | } | 167 | } |
168 | 168 | ||
169 | static void | 169 | static void |
170 | address_suggest_cb (void *cls, const struct GNUNET_HELLO_Address *address, | 170 | address_suggest_cb (void *cls, |
171 | const struct GNUNET_PeerIdentity *peer, | ||
172 | const struct GNUNET_HELLO_Address *address, | ||
171 | struct Session *session, | 173 | struct Session *session, |
172 | struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out, | 174 | struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out, |
173 | struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in, | 175 | struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in, |
@@ -288,7 +290,7 @@ stat_cb(void *cls, const char *subsystem, | |||
288 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, "All addresses added, requesting....\n"); | 290 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, "All addresses added, requesting....\n"); |
289 | /* We have 2 addresses, so we can request */ | 291 | /* We have 2 addresses, so we can request */ |
290 | addresses_added = GNUNET_YES; | 292 | addresses_added = GNUNET_YES; |
291 | GNUNET_ATS_suggest_address (sched_ats, &p.id); | 293 | GNUNET_ATS_suggest_address (sched_ats, &p.id, NULL, NULL); |
292 | } | 294 | } |
293 | return GNUNET_OK; | 295 | return GNUNET_OK; |
294 | } | 296 | } |
diff --git a/src/ats/test_ats_solver_convergence.c b/src/ats/test_ats_solver_convergence.c index ff476a8c8..40733bc50 100755 --- a/src/ats/test_ats_solver_convergence.c +++ b/src/ats/test_ats_solver_convergence.c | |||
@@ -152,7 +152,9 @@ end_badly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
152 | } | 152 | } |
153 | 153 | ||
154 | static void | 154 | static void |
155 | address_suggest_cb (void *cls, const struct GNUNET_HELLO_Address *address, | 155 | address_suggest_cb (void *cls, |
156 | const struct GNUNET_PeerIdentity *peer, | ||
157 | const struct GNUNET_HELLO_Address *address, | ||
156 | struct Session *session, | 158 | struct Session *session, |
157 | struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out, | 159 | struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out, |
158 | struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in, | 160 | struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in, |
diff --git a/src/ats/test_ats_solver_preferences.c b/src/ats/test_ats_solver_preferences.c index 0c7076ded..117af470b 100644 --- a/src/ats/test_ats_solver_preferences.c +++ b/src/ats/test_ats_solver_preferences.c | |||
@@ -150,10 +150,14 @@ perf_info_cb (void *cls, | |||
150 | } | 150 | } |
151 | 151 | ||
152 | static void | 152 | static void |
153 | address_suggest_cb (void *cls, const struct GNUNET_HELLO_Address *address, | 153 | address_suggest_cb (void *cls, |
154 | struct Session *session, struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out, | 154 | const struct GNUNET_PeerIdentity *peer, |
155 | struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in, | 155 | const struct GNUNET_HELLO_Address *address, |
156 | const struct GNUNET_ATS_Information *atsi, uint32_t ats_count) | 156 | struct Session *session, |
157 | struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out, | ||
158 | struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in, | ||
159 | const struct GNUNET_ATS_Information *atsi, | ||
160 | uint32_t ats_count) | ||
157 | { | 161 | { |
158 | int c; | 162 | int c; |
159 | double pref_val; | 163 | double pref_val; |
@@ -249,7 +253,7 @@ run (void *cls, const struct GNUNET_CONFIGURATION_Handle *mycfg, | |||
249 | /* Adding address */ | 253 | /* Adding address */ |
250 | GNUNET_ATS_address_add (sched_ats, &test_hello_address, test_session, | 254 | GNUNET_ATS_address_add (sched_ats, &test_hello_address, test_session, |
251 | test_ats_info, test_ats_count); | 255 | test_ats_info, test_ats_count); |
252 | GNUNET_ATS_suggest_address(sched_ats, &test_hello_address.peer); | 256 | GNUNET_ATS_suggest_address(sched_ats, &test_hello_address.peer, NULL, NULL); |
253 | } | 257 | } |
254 | 258 | ||
255 | int | 259 | int |
diff --git a/src/ats/test_ats_solver_request_and_add_address.c b/src/ats/test_ats_solver_request_and_add_address.c index 757423200..a8389ea89 100644 --- a/src/ats/test_ats_solver_request_and_add_address.c +++ b/src/ats/test_ats_solver_request_and_add_address.c | |||
@@ -128,7 +128,9 @@ end_badly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
128 | } | 128 | } |
129 | 129 | ||
130 | static void | 130 | static void |
131 | address_suggest_cb (void *cls, const struct GNUNET_HELLO_Address *address, | 131 | address_suggest_cb (void *cls, |
132 | const struct GNUNET_PeerIdentity *peer, | ||
133 | const struct GNUNET_HELLO_Address *address, | ||
132 | struct Session *session, | 134 | struct Session *session, |
133 | struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out, | 135 | struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out, |
134 | struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in, | 136 | struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in, |
@@ -199,7 +201,7 @@ run (void *cls, const struct GNUNET_CONFIGURATION_Handle *mycfg, | |||
199 | test_hello_address.address_length = test_addr.addr_len; | 201 | test_hello_address.address_length = test_addr.addr_len; |
200 | 202 | ||
201 | /* Request */ | 203 | /* Request */ |
202 | GNUNET_ATS_suggest_address (sched_ats, &p.id); | 204 | GNUNET_ATS_suggest_address (sched_ats, &p.id, NULL, NULL); |
203 | 205 | ||
204 | 206 | ||
205 | /* Adding address */ | 207 | /* Adding address */ |
diff --git a/src/ats/test_ats_solver_request_and_delete_address.c b/src/ats/test_ats_solver_request_and_delete_address.c index 48ee8014c..05a045e3b 100644 --- a/src/ats/test_ats_solver_request_and_delete_address.c +++ b/src/ats/test_ats_solver_request_and_delete_address.c | |||
@@ -131,7 +131,9 @@ end_badly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
131 | } | 131 | } |
132 | 132 | ||
133 | static void | 133 | static void |
134 | address_suggest_cb (void *cls, const struct GNUNET_HELLO_Address *address, | 134 | address_suggest_cb (void *cls, |
135 | const struct GNUNET_PeerIdentity *peer, | ||
136 | const struct GNUNET_HELLO_Address *address, | ||
135 | struct Session *session, | 137 | struct Session *session, |
136 | struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out, | 138 | struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out, |
137 | struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in, | 139 | struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in, |
@@ -184,7 +186,7 @@ stat_cb(void *cls, const char *subsystem, | |||
184 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, "ATS statistics: `%s' `%s' %llu\n", | 186 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, "ATS statistics: `%s' `%s' %llu\n", |
185 | subsystem,name, value); | 187 | subsystem,name, value); |
186 | if (GNUNET_NO == address_deleted) | 188 | if (GNUNET_NO == address_deleted) |
187 | GNUNET_ATS_suggest_address (sched_ats, &p.id); | 189 | GNUNET_ATS_suggest_address (sched_ats, &p.id, NULL, NULL); |
188 | return GNUNET_OK; | 190 | return GNUNET_OK; |
189 | } | 191 | } |
190 | 192 | ||
diff --git a/src/include/gnunet_ats_service.h b/src/include/gnunet_ats_service.h index 329d81161..932446400 100644 --- a/src/include/gnunet_ats_service.h +++ b/src/include/gnunet_ats_service.h | |||
@@ -543,6 +543,11 @@ struct Session; | |||
543 | * Signature of a function called by ATS with the current bandwidth | 543 | * Signature of a function called by ATS with the current bandwidth |
544 | * and address preferences as determined by ATS. | 544 | * and address preferences as determined by ATS. |
545 | * | 545 | * |
546 | * If an address is available immediately the address will be included. If no | ||
547 | * address can be suggested, address, session, bandwidth and ATS information will | ||
548 | * be NULL/0. ATS will suggest an address as soon as it can provide such an | ||
549 | * address | ||
550 | * | ||
546 | * @param cls closure | 551 | * @param cls closure |
547 | * @param address suggested address (including peer identity of the peer) | 552 | * @param address suggested address (including peer identity of the peer) |
548 | * @param session session to use | 553 | * @param session session to use |
@@ -553,11 +558,13 @@ struct Session; | |||
553 | */ | 558 | */ |
554 | typedef void | 559 | typedef void |
555 | (*GNUNET_ATS_AddressSuggestionCallback) (void *cls, | 560 | (*GNUNET_ATS_AddressSuggestionCallback) (void *cls, |
561 | const struct GNUNET_PeerIdentity *peer, | ||
556 | const struct GNUNET_HELLO_Address *address, struct Session *session, | 562 | const struct GNUNET_HELLO_Address *address, struct Session *session, |
557 | struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out, | 563 | struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out, |
558 | struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in, | 564 | struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in, |
559 | const struct GNUNET_ATS_Information *ats, uint32_t ats_count); | 565 | const struct GNUNET_ATS_Information *ats, uint32_t ats_count); |
560 | 566 | ||
567 | |||
561 | /** | 568 | /** |
562 | * Initialize the ATS subsystem. | 569 | * Initialize the ATS subsystem. |
563 | * | 570 | * |
@@ -596,11 +603,15 @@ GNUNET_ATS_reset_backoff (struct GNUNET_ATS_SchedulingHandle *sh, | |||
596 | * | 603 | * |
597 | * @param sh handle | 604 | * @param sh handle |
598 | * @param peer identity of the peer we need an address for | 605 | * @param peer identity of the peer we need an address for |
606 | * @param cont the continuation to indicate success to call with the address | ||
607 | * @param cont_cls the cls for the continuation | ||
599 | * @return suggestion handle | 608 | * @return suggestion handle |
600 | */ | 609 | */ |
601 | struct GNUNET_ATS_SuggestHandle * | 610 | struct GNUNET_ATS_SuggestHandle * |
602 | GNUNET_ATS_suggest_address (struct GNUNET_ATS_SchedulingHandle *sh, | 611 | GNUNET_ATS_suggest_address (struct GNUNET_ATS_SchedulingHandle *sh, |
603 | const struct GNUNET_PeerIdentity *peer); | 612 | const struct GNUNET_PeerIdentity *peer, |
613 | GNUNET_ATS_AddressSuggestionCallback cont, | ||
614 | void *cont_cls); | ||
604 | 615 | ||
605 | 616 | ||
606 | /** | 617 | /** |
diff --git a/src/transport/gnunet-service-transport.c b/src/transport/gnunet-service-transport.c index 811ef5857..a5ce3fa4a 100644 --- a/src/transport/gnunet-service-transport.c +++ b/src/transport/gnunet-service-transport.c | |||
@@ -754,6 +754,7 @@ plugin_env_session_start (void *cls, | |||
754 | */ | 754 | */ |
755 | static void | 755 | static void |
756 | ats_request_address_change (void *cls, | 756 | ats_request_address_change (void *cls, |
757 | const struct GNUNET_PeerIdentity *peer, | ||
757 | const struct GNUNET_HELLO_Address *address, | 758 | const struct GNUNET_HELLO_Address *address, |
758 | struct Session *session, | 759 | struct Session *session, |
759 | struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out, | 760 | struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out, |
@@ -773,6 +774,7 @@ ats_request_address_change (void *cls, | |||
773 | GST_neighbours_force_disconnect (&address->peer); | 774 | GST_neighbours_force_disconnect (&address->peer); |
774 | return; | 775 | return; |
775 | } | 776 | } |
777 | |||
776 | GST_neighbours_switch_to_address (&address->peer, address, session, ats, | 778 | GST_neighbours_switch_to_address (&address->peer, address, session, ats, |
777 | ats_count, bandwidth_in, | 779 | ats_count, bandwidth_in, |
778 | bandwidth_out); | 780 | bandwidth_out); |
diff --git a/src/transport/gnunet-service-transport_neighbours.c b/src/transport/gnunet-service-transport_neighbours.c index 54a35caa6..f5d44fa1d 100644 --- a/src/transport/gnunet-service-transport_neighbours.c +++ b/src/transport/gnunet-service-transport_neighbours.c | |||
@@ -1742,6 +1742,18 @@ address_matches (const struct NeighbourAddress *a1, | |||
1742 | } | 1742 | } |
1743 | 1743 | ||
1744 | 1744 | ||
1745 | static void | ||
1746 | address_suggest_cont (void *cls, | ||
1747 | const struct GNUNET_PeerIdentity *peer, | ||
1748 | const struct GNUNET_HELLO_Address *address, struct Session *session, | ||
1749 | struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out, | ||
1750 | struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in, | ||
1751 | const struct GNUNET_ATS_Information *ats, uint32_t ats_count) | ||
1752 | { | ||
1753 | |||
1754 | } | ||
1755 | |||
1756 | |||
1745 | /** | 1757 | /** |
1746 | * Try to create a connection to the given target (eventually). | 1758 | * Try to create a connection to the given target (eventually). |
1747 | * | 1759 | * |
@@ -1814,7 +1826,7 @@ GST_neighbours_try_connect (const struct GNUNET_PeerIdentity *target) | |||
1814 | set_state_and_timeout (n, GNUNET_TRANSPORT_INIT_ATS, GNUNET_TIME_relative_to_absolute (ATS_RESPONSE_TIMEOUT)); | 1826 | set_state_and_timeout (n, GNUNET_TRANSPORT_INIT_ATS, GNUNET_TIME_relative_to_absolute (ATS_RESPONSE_TIMEOUT)); |
1815 | 1827 | ||
1816 | GNUNET_ATS_reset_backoff (GST_ats, target); | 1828 | GNUNET_ATS_reset_backoff (GST_ats, target); |
1817 | n->suggest_handle = GNUNET_ATS_suggest_address (GST_ats, target); | 1829 | n->suggest_handle = GNUNET_ATS_suggest_address (GST_ats, target, &address_suggest_cont, n); |
1818 | } | 1830 | } |
1819 | 1831 | ||
1820 | 1832 | ||
@@ -1923,7 +1935,7 @@ handle_test_blacklist_cont (void *cls, | |||
1923 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1935 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
1924 | "Suggesting address for peer %s to ATS\n", | 1936 | "Suggesting address for peer %s to ATS\n", |
1925 | GNUNET_i2s (peer)); | 1937 | GNUNET_i2s (peer)); |
1926 | n->suggest_handle = GNUNET_ATS_suggest_address (GST_ats, peer); | 1938 | n->suggest_handle = GNUNET_ATS_suggest_address (GST_ats, peer, &address_suggest_cont, n); |
1927 | break; | 1939 | break; |
1928 | case GNUNET_TRANSPORT_CONNECT_RECV_ATS: | 1940 | case GNUNET_TRANSPORT_CONNECT_RECV_ATS: |
1929 | /* waiting on ATS suggestion, don't care about blacklist */ | 1941 | /* waiting on ATS suggestion, don't care about blacklist */ |
@@ -2214,7 +2226,6 @@ GST_neighbours_handle_connect (const struct GNUNET_MessageHeader *message, | |||
2214 | n = setup_neighbour (peer); | 2226 | n = setup_neighbour (peer); |
2215 | set_state (n, GNUNET_TRANSPORT_CONNECT_RECV_ATS); | 2227 | set_state (n, GNUNET_TRANSPORT_CONNECT_RECV_ATS); |
2216 | GNUNET_ATS_reset_backoff (GST_ats, peer); | 2228 | GNUNET_ATS_reset_backoff (GST_ats, peer); |
2217 | n->suggest_handle = GNUNET_ATS_suggest_address (GST_ats, peer); | ||
2218 | break; | 2229 | break; |
2219 | case GNUNET_TRANSPORT_DISCONNECT_FINISHED: | 2230 | case GNUNET_TRANSPORT_DISCONNECT_FINISHED: |
2220 | /* should not be possible */ | 2231 | /* should not be possible */ |