diff options
author | Christian Grothoff <christian@grothoff.org> | 2015-10-18 12:49:23 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2015-10-18 12:49:23 +0000 |
commit | 2128c61720c9019302a1add71796c69d2ee36fc4 (patch) | |
tree | b665fa4994da1132b6e5d85312bfacab9460d8a9 /src/ats/ats_api_connectivity.c | |
parent | 9cd0d5068f3341fe8451a61872894f28a5ac9047 (diff) | |
download | gnunet-2128c61720c9019302a1add71796c69d2ee36fc4.tar.gz gnunet-2128c61720c9019302a1add71796c69d2ee36fc4.zip |
add 'strength' argument to address suggestion request for ATS
Diffstat (limited to 'src/ats/ats_api_connectivity.c')
-rw-r--r-- | src/ats/ats_api_connectivity.c | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/src/ats/ats_api_connectivity.c b/src/ats/ats_api_connectivity.c index 4099cadbd..1012e9cee 100644 --- a/src/ats/ats_api_connectivity.c +++ b/src/ats/ats_api_connectivity.c | |||
@@ -45,6 +45,11 @@ struct GNUNET_ATS_ConnectivitySuggestHandle | |||
45 | * Connecitivity handle this suggestion handle belongs to. | 45 | * Connecitivity handle this suggestion handle belongs to. |
46 | */ | 46 | */ |
47 | struct GNUNET_ATS_ConnectivityHandle *ch; | 47 | struct GNUNET_ATS_ConnectivityHandle *ch; |
48 | |||
49 | /** | ||
50 | * How urgent is the request. | ||
51 | */ | ||
52 | uint32_t strength; | ||
48 | }; | 53 | }; |
49 | 54 | ||
50 | 55 | ||
@@ -174,13 +179,14 @@ transmit_suggestion (void *cls, | |||
174 | void *value) | 179 | void *value) |
175 | { | 180 | { |
176 | struct GNUNET_ATS_ConnectivityHandle *ch = cls; | 181 | struct GNUNET_ATS_ConnectivityHandle *ch = cls; |
182 | struct GNUNET_ATS_ConnectivitySuggestHandle *sh = value; | ||
177 | struct GNUNET_MQ_Envelope *ev; | 183 | struct GNUNET_MQ_Envelope *ev; |
178 | struct RequestAddressMessage *m; | 184 | struct RequestAddressMessage *m; |
179 | 185 | ||
180 | if (NULL == ch->mq) | 186 | if (NULL == ch->mq) |
181 | return GNUNET_SYSERR; | 187 | return GNUNET_SYSERR; |
182 | ev = GNUNET_MQ_msg (m, GNUNET_MESSAGE_TYPE_ATS_REQUEST_ADDRESS); | 188 | ev = GNUNET_MQ_msg (m, GNUNET_MESSAGE_TYPE_ATS_REQUEST_ADDRESS); |
183 | m->reserved = htonl (0); | 189 | m->strength = htonl (sh->strength); |
184 | m->peer = *peer; | 190 | m->peer = *peer; |
185 | GNUNET_MQ_send (ch->mq, ev); | 191 | GNUNET_MQ_send (ch->mq, ev); |
186 | return GNUNET_OK; | 192 | return GNUNET_OK; |
@@ -244,7 +250,7 @@ GNUNET_ATS_connectivity_init (const struct GNUNET_CONFIGURATION_Handle *cfg) | |||
244 | 250 | ||
245 | 251 | ||
246 | /** | 252 | /** |
247 | * Function called to free all `struct GNUNET_ATS_SuggestHandles` | 253 | * Function called to free all `struct GNUNET_ATS_ConnectivitySuggestHandle`s |
248 | * in the map. | 254 | * in the map. |
249 | * | 255 | * |
250 | * @param cls NULL | 256 | * @param cls NULL |
@@ -303,11 +309,13 @@ GNUNET_ATS_connectivity_done (struct GNUNET_ATS_ConnectivityHandle *ch) | |||
303 | * | 309 | * |
304 | * @param ch handle | 310 | * @param ch handle |
305 | * @param peer identity of the peer we need an address for | 311 | * @param peer identity of the peer we need an address for |
312 | * @param strength how urgent is the need for such a suggestion | ||
306 | * @return suggest handle, NULL if a request is already pending | 313 | * @return suggest handle, NULL if a request is already pending |
307 | */ | 314 | */ |
308 | struct GNUNET_ATS_ConnectivitySuggestHandle * | 315 | struct GNUNET_ATS_ConnectivitySuggestHandle * |
309 | GNUNET_ATS_connectivity_suggest (struct GNUNET_ATS_ConnectivityHandle *ch, | 316 | GNUNET_ATS_connectivity_suggest (struct GNUNET_ATS_ConnectivityHandle *ch, |
310 | const struct GNUNET_PeerIdentity *peer) | 317 | const struct GNUNET_PeerIdentity *peer, |
318 | uint32_t strength) | ||
311 | { | 319 | { |
312 | struct GNUNET_ATS_ConnectivitySuggestHandle *s; | 320 | struct GNUNET_ATS_ConnectivitySuggestHandle *s; |
313 | 321 | ||
@@ -317,6 +325,7 @@ GNUNET_ATS_connectivity_suggest (struct GNUNET_ATS_ConnectivityHandle *ch, | |||
317 | s = GNUNET_new (struct GNUNET_ATS_ConnectivitySuggestHandle); | 325 | s = GNUNET_new (struct GNUNET_ATS_ConnectivitySuggestHandle); |
318 | s->ch = ch; | 326 | s->ch = ch; |
319 | s->id = *peer; | 327 | s->id = *peer; |
328 | s->strength = strength; | ||
320 | if (GNUNET_OK != | 329 | if (GNUNET_OK != |
321 | GNUNET_CONTAINER_multipeermap_put (ch->sug_requests, | 330 | GNUNET_CONTAINER_multipeermap_put (ch->sug_requests, |
322 | &s->id, | 331 | &s->id, |
@@ -360,7 +369,7 @@ GNUNET_ATS_connectivity_suggest_cancel (struct GNUNET_ATS_ConnectivitySuggestHan | |||
360 | return; | 369 | return; |
361 | } | 370 | } |
362 | ev = GNUNET_MQ_msg (m, GNUNET_MESSAGE_TYPE_ATS_REQUEST_ADDRESS_CANCEL); | 371 | ev = GNUNET_MQ_msg (m, GNUNET_MESSAGE_TYPE_ATS_REQUEST_ADDRESS_CANCEL); |
363 | m->reserved = htonl (0); | 372 | m->strength = htonl (0); |
364 | m->peer = sh->id; | 373 | m->peer = sh->id; |
365 | GNUNET_MQ_send (ch->mq, ev); | 374 | GNUNET_MQ_send (ch->mq, ev); |
366 | GNUNET_free (sh); | 375 | GNUNET_free (sh); |