diff options
author | t3sserakt <t3ss@posteo.de> | 2023-06-19 15:39:36 +0200 |
---|---|---|
committer | t3sserakt <t3ss@posteo.de> | 2023-06-19 15:39:36 +0200 |
commit | b78f99388e82b61cd6fde7e2f153c50b96dca3dc (patch) | |
tree | f367da4faee0cdc8ba4279469a2b0fc79b90b9ed | |
parent | 823fbe0ecac89397d8a3ab15cf7ef9b3f84a883f (diff) | |
download | gnunet-b78f99388e82b61cd6fde7e2f153c50b96dca3dc.tar.gz gnunet-b78f99388e82b61cd6fde7e2f153c50b96dca3dc.zip |
NEWS: Removed all usage of old transport api, beside peerinfo tool, gnunet-transport cli and usage in transport layer itself.
25 files changed, 115 insertions, 433 deletions
diff --git a/src/cadet/Makefile.am b/src/cadet/Makefile.am index d942c6495..ec95c7490 100644 --- a/src/cadet/Makefile.am +++ b/src/cadet/Makefile.am | |||
@@ -69,6 +69,7 @@ gnunet_service_cadet_LDADD = \ | |||
69 | $(top_builddir)/src/dht/libgnunetdht.la \ | 69 | $(top_builddir)/src/dht/libgnunetdht.la \ |
70 | $(top_builddir)/src/statistics/libgnunetstatistics.la \ | 70 | $(top_builddir)/src/statistics/libgnunetstatistics.la \ |
71 | $(top_builddir)/src/transport/libgnunettransport.la \ | 71 | $(top_builddir)/src/transport/libgnunettransport.la \ |
72 | $(top_builddir)/src/transport/libgnunettransportapplication.la \ | ||
72 | $(top_builddir)/src/peerinfo/libgnunetpeerinfo.la \ | 73 | $(top_builddir)/src/peerinfo/libgnunetpeerinfo.la \ |
73 | $(top_builddir)/src/hello/libgnunethello.la \ | 74 | $(top_builddir)/src/hello/libgnunethello.la \ |
74 | $(top_builddir)/src/block/libgnunetblock.la | 75 | $(top_builddir)/src/block/libgnunetblock.la |
diff --git a/src/cadet/gnunet-service-cadet.c b/src/cadet/gnunet-service-cadet.c index 07b580005..fd1365561 100644 --- a/src/cadet/gnunet-service-cadet.c +++ b/src/cadet/gnunet-service-cadet.c | |||
@@ -36,6 +36,7 @@ | |||
36 | #include "gnunet_util_lib.h" | 36 | #include "gnunet_util_lib.h" |
37 | #include "cadet.h" | 37 | #include "cadet.h" |
38 | #include "gnunet_statistics_service.h" | 38 | #include "gnunet_statistics_service.h" |
39 | #include "gnunet_transport_application_service.h" | ||
39 | #include "gnunet-service-cadet.h" | 40 | #include "gnunet-service-cadet.h" |
40 | #include "gnunet-service-cadet_channel.h" | 41 | #include "gnunet-service-cadet_channel.h" |
41 | #include "gnunet-service-cadet_connection.h" | 42 | #include "gnunet-service-cadet_connection.h" |
@@ -45,6 +46,8 @@ | |||
45 | #include "gnunet-service-cadet_tunnels.h" | 46 | #include "gnunet-service-cadet_tunnels.h" |
46 | #include "gnunet-service-cadet_peer.h" | 47 | #include "gnunet-service-cadet_peer.h" |
47 | #include "gnunet-service-cadet_paths.h" | 48 | #include "gnunet-service-cadet_paths.h" |
49 | #include "gnunet_constants.h" | ||
50 | |||
48 | 51 | ||
49 | #define LOG(level, ...) GNUNET_log (level, __VA_ARGS__) | 52 | #define LOG(level, ...) GNUNET_log (level, __VA_ARGS__) |
50 | 53 | ||
@@ -116,9 +119,9 @@ const struct GNUNET_CONFIGURATION_Handle *cfg; | |||
116 | struct GNUNET_STATISTICS_Handle *stats; | 119 | struct GNUNET_STATISTICS_Handle *stats; |
117 | 120 | ||
118 | /** | 121 | /** |
119 | * Handle to communicate with ATS. | 122 | * Handle to Transport service. |
120 | */ | 123 | */ |
121 | struct GNUNET_ATS_ConnectivityHandle *ats_ch; | 124 | struct GNUNET_TRANSPORT_ApplicationHandle *transport; |
122 | 125 | ||
123 | /** | 126 | /** |
124 | * Local peer own ID. | 127 | * Local peer own ID. |
@@ -408,10 +411,10 @@ shutdown_rest () | |||
408 | GNUNET_CONTAINER_multishortmap_destroy (connections); | 411 | GNUNET_CONTAINER_multishortmap_destroy (connections); |
409 | connections = NULL; | 412 | connections = NULL; |
410 | } | 413 | } |
411 | if (NULL != ats_ch) | 414 | if (NULL != transport) |
412 | { | 415 | { |
413 | GNUNET_ATS_connectivity_done (ats_ch); | 416 | GNUNET_TRANSPORT_application_done (transport); |
414 | ats_ch = NULL; | 417 | transport = NULL; |
415 | } | 418 | } |
416 | GCD_shutdown (); | 419 | GCD_shutdown (); |
417 | GCH_shutdown (); | 420 | GCH_shutdown (); |
@@ -1278,28 +1281,7 @@ run (void *cls, | |||
1278 | { | 1281 | { |
1279 | drop_percent = 0; | 1282 | drop_percent = 0; |
1280 | } | 1283 | } |
1281 | else | 1284 | transport = GNUNET_TRANSPORT_application_init (c); |
1282 | { | ||
1283 | LOG (GNUNET_ERROR_TYPE_WARNING, "**************************************\n"); | ||
1284 | LOG (GNUNET_ERROR_TYPE_WARNING, "Cadet is running with DROP enabled.\n"); | ||
1285 | LOG (GNUNET_ERROR_TYPE_WARNING, "This is NOT a good idea!\n"); | ||
1286 | LOG (GNUNET_ERROR_TYPE_WARNING, "Remove DROP_PERCENT from config file.\n"); | ||
1287 | LOG (GNUNET_ERROR_TYPE_WARNING, "**************************************\n"); | ||
1288 | } | ||
1289 | my_private_key = GNUNET_CRYPTO_eddsa_key_create_from_configuration (c); | ||
1290 | if (NULL == my_private_key) | ||
1291 | { | ||
1292 | GNUNET_break (0); | ||
1293 | GNUNET_SCHEDULER_shutdown (); | ||
1294 | return; | ||
1295 | } | ||
1296 | GNUNET_CRYPTO_eddsa_key_get_public (my_private_key, | ||
1297 | &my_full_id.public_key); | ||
1298 | stats = GNUNET_STATISTICS_create ("cadet", | ||
1299 | c); | ||
1300 | GNUNET_SCHEDULER_add_shutdown (&shutdown_task, | ||
1301 | NULL); | ||
1302 | ats_ch = GNUNET_ATS_connectivity_init (c); | ||
1303 | /* FIXME: optimize code to allow GNUNET_YES here! */ | 1285 | /* FIXME: optimize code to allow GNUNET_YES here! */ |
1304 | open_ports = GNUNET_CONTAINER_multihashmap_create (16, | 1286 | open_ports = GNUNET_CONTAINER_multihashmap_create (16, |
1305 | GNUNET_NO); | 1287 | GNUNET_NO); |
diff --git a/src/cadet/gnunet-service-cadet.h b/src/cadet/gnunet-service-cadet.h index 3d61b9973..8f2386d00 100644 --- a/src/cadet/gnunet-service-cadet.h +++ b/src/cadet/gnunet-service-cadet.h | |||
@@ -197,9 +197,9 @@ extern const struct GNUNET_CONFIGURATION_Handle *cfg; | |||
197 | extern struct GNUNET_STATISTICS_Handle *stats; | 197 | extern struct GNUNET_STATISTICS_Handle *stats; |
198 | 198 | ||
199 | /** | 199 | /** |
200 | * Handle to communicate with ATS. | 200 | * Handle to Transport service. |
201 | */ | 201 | */ |
202 | extern struct GNUNET_ATS_ConnectivityHandle *ats_ch; | 202 | extern struct GNUNET_TRANSPORT_ApplicationHandle *transport; |
203 | 203 | ||
204 | /** | 204 | /** |
205 | * Local peer own ID. | 205 | * Local peer own ID. |
diff --git a/src/cadet/gnunet-service-cadet_peer.c b/src/cadet/gnunet-service-cadet_peer.c index f2b508ae0..6d6288e8d 100644 --- a/src/cadet/gnunet-service-cadet_peer.c +++ b/src/cadet/gnunet-service-cadet_peer.c | |||
@@ -35,7 +35,7 @@ | |||
35 | #include "gnunet_util_lib.h" | 35 | #include "gnunet_util_lib.h" |
36 | #include "gnunet_hello_lib.h" | 36 | #include "gnunet_hello_lib.h" |
37 | #include "gnunet_signatures.h" | 37 | #include "gnunet_signatures.h" |
38 | #include "gnunet_transport_service.h" | 38 | #include "gnunet_transport_application_service.h" |
39 | #include "gnunet_ats_service.h" | 39 | #include "gnunet_ats_service.h" |
40 | #include "gnunet_core_service.h" | 40 | #include "gnunet_core_service.h" |
41 | #include "gnunet_statistics_service.h" | 41 | #include "gnunet_statistics_service.h" |
@@ -194,10 +194,9 @@ struct CadetPeer | |||
194 | struct GNUNET_TRANSPORT_OfferHelloHandle *hello_offer; | 194 | struct GNUNET_TRANSPORT_OfferHelloHandle *hello_offer; |
195 | 195 | ||
196 | /** | 196 | /** |
197 | * Handle to our ATS request asking ATS to suggest an address | 197 | * Transport suggest handle. |
198 | * to TRANSPORT for this peer (to establish a direct link). | ||
199 | */ | 198 | */ |
200 | struct GNUNET_ATS_ConnectivitySuggestHandle *connectivity_suggestion; | 199 | struct GNUNET_TRANSPORT_ApplicationSuggestHandle *ash; |
201 | 200 | ||
202 | /** | 201 | /** |
203 | * How many messages are in the queue to this peer. | 202 | * How many messages are in the queue to this peer. |
@@ -334,15 +333,11 @@ destroy_peer (void *cls) | |||
334 | } | 333 | } |
335 | /* FIXME: clean up search_delayedXXX! */ | 334 | /* FIXME: clean up search_delayedXXX! */ |
336 | 335 | ||
337 | if (NULL != cp->hello_offer) | 336 | |
338 | { | 337 | if (NULL != cp->ash) |
339 | GNUNET_TRANSPORT_offer_hello_cancel (cp->hello_offer); | ||
340 | cp->hello_offer = NULL; | ||
341 | } | ||
342 | if (NULL != cp->connectivity_suggestion) | ||
343 | { | 338 | { |
344 | GNUNET_ATS_connectivity_suggest_cancel (cp->connectivity_suggestion); | 339 | GNUNET_TRANSPORT_application_suggest_cancel (cp->ash); |
345 | cp->connectivity_suggestion = NULL; | 340 | cp->ash = NULL; |
346 | } | 341 | } |
347 | GNUNET_CONTAINER_multishortmap_destroy (cp->connections); | 342 | GNUNET_CONTAINER_multishortmap_destroy (cp->connections); |
348 | if (NULL != cp->path_heap) | 343 | if (NULL != cp->path_heap) |
@@ -375,6 +370,7 @@ static void | |||
375 | consider_peer_activate (struct CadetPeer *cp) | 370 | consider_peer_activate (struct CadetPeer *cp) |
376 | { | 371 | { |
377 | uint32_t strength; | 372 | uint32_t strength; |
373 | struct GNUNET_BANDWIDTH_Value32NBO bw; | ||
378 | 374 | ||
379 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 375 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
380 | "Updating peer %s activation state (%u connections)%s%s\n", | 376 | "Updating peer %s activation state (%u connections)%s%s\n", |
@@ -392,10 +388,10 @@ consider_peer_activate (struct CadetPeer *cp) | |||
392 | (NULL == cp->t)) | 388 | (NULL == cp->t)) |
393 | { | 389 | { |
394 | /* We're just on a path or directly connected; don't bother too much */ | 390 | /* We're just on a path or directly connected; don't bother too much */ |
395 | if (NULL != cp->connectivity_suggestion) | 391 | if (NULL != cp->ash) |
396 | { | 392 | { |
397 | GNUNET_ATS_connectivity_suggest_cancel (cp->connectivity_suggestion); | 393 | GNUNET_TRANSPORT_application_suggest_cancel (cp->ash); |
398 | cp->connectivity_suggestion = NULL; | 394 | cp->ash = NULL; |
399 | } | 395 | } |
400 | if (NULL != cp->search_h) | 396 | if (NULL != cp->search_h) |
401 | { | 397 | { |
@@ -424,12 +420,13 @@ consider_peer_activate (struct CadetPeer *cp) | |||
424 | 420 | ||
425 | /* If we have a tunnel, our urge for connections is much bigger */ | 421 | /* If we have a tunnel, our urge for connections is much bigger */ |
426 | strength = (NULL != cp->t) ? 32 : 1; | 422 | strength = (NULL != cp->t) ? 32 : 1; |
427 | if (NULL != cp->connectivity_suggestion) | 423 | if (NULL != cp->ash) |
428 | GNUNET_ATS_connectivity_suggest_cancel (cp->connectivity_suggestion); | 424 | GNUNET_TRANSPORT_application_suggest_cancel (cp->ash); |
429 | cp->connectivity_suggestion | 425 | cp->ash |
430 | = GNUNET_ATS_connectivity_suggest (ats_ch, | 426 | = GNUNET_TRANSPORT_application_suggest (transport, |
431 | &cp->pid, | 427 | &cp->pid, |
432 | strength); | 428 | GNUNET_MQ_PRIO_BEST_EFFORT, |
429 | bw); | ||
433 | } | 430 | } |
434 | 431 | ||
435 | 432 | ||
@@ -1308,36 +1305,17 @@ GCP_get_tunnel (struct CadetPeer *cp, | |||
1308 | } | 1305 | } |
1309 | 1306 | ||
1310 | 1307 | ||
1311 | /** | ||
1312 | * Hello offer was passed to the transport service. Mark it | ||
1313 | * as done. | ||
1314 | * | ||
1315 | * @param cls the `struct CadetPeer` where the offer completed | ||
1316 | */ | ||
1317 | static void | ||
1318 | hello_offer_done (void *cls) | ||
1319 | { | ||
1320 | struct CadetPeer *cp = cls; | ||
1321 | |||
1322 | cp->hello_offer = NULL; | ||
1323 | } | ||
1324 | |||
1325 | |||
1326 | void | 1308 | void |
1327 | GCP_set_hello (struct CadetPeer *cp, | 1309 | GCP_set_hello (struct CadetPeer *cp, |
1328 | const struct GNUNET_HELLO_Message *hello) | 1310 | const struct GNUNET_HELLO_Message *hello) |
1329 | { | 1311 | { |
1330 | struct GNUNET_HELLO_Message *mrg; | 1312 | struct GNUNET_HELLO_Message *mrg; |
1313 | struct GNUNET_BANDWIDTH_Value32NBO bw; | ||
1331 | 1314 | ||
1332 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 1315 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
1333 | "Got %u byte HELLO for peer %s\n", | 1316 | "Got %u byte HELLO for peer %s\n", |
1334 | (unsigned int) GNUNET_HELLO_size (hello), | 1317 | (unsigned int) GNUNET_HELLO_size (hello), |
1335 | GCP_2s (cp)); | 1318 | GCP_2s (cp)); |
1336 | if (NULL != cp->hello_offer) | ||
1337 | { | ||
1338 | GNUNET_TRANSPORT_offer_hello_cancel (cp->hello_offer); | ||
1339 | cp->hello_offer = NULL; | ||
1340 | } | ||
1341 | if (NULL != cp->hello) | 1319 | if (NULL != cp->hello) |
1342 | { | 1320 | { |
1343 | mrg = GNUNET_HELLO_merge (hello, | 1321 | mrg = GNUNET_HELLO_merge (hello, |
@@ -1350,11 +1328,13 @@ GCP_set_hello (struct CadetPeer *cp, | |||
1350 | cp->hello = GNUNET_memdup (hello, | 1328 | cp->hello = GNUNET_memdup (hello, |
1351 | GNUNET_HELLO_size (hello)); | 1329 | GNUNET_HELLO_size (hello)); |
1352 | } | 1330 | } |
1353 | cp->hello_offer | 1331 | if (NULL != cp->ash) |
1354 | = GNUNET_TRANSPORT_offer_hello (cfg, | 1332 | GNUNET_TRANSPORT_application_suggest_cancel (cp->ash); |
1355 | GNUNET_HELLO_get_header (cp->hello), | 1333 | cp->ash |
1356 | &hello_offer_done, | 1334 | = GNUNET_TRANSPORT_application_suggest (transport, |
1357 | cp); | 1335 | &cp->pid, |
1336 | GNUNET_MQ_PRIO_BEST_EFFORT, | ||
1337 | bw); | ||
1358 | /* New HELLO means cp's destruction time may change... */ | 1338 | /* New HELLO means cp's destruction time may change... */ |
1359 | consider_peer_destroy (cp); | 1339 | consider_peer_destroy (cp); |
1360 | } | 1340 | } |
diff --git a/src/core/core.h b/src/core/core.h index 17df7acb7..d4596f038 100644 --- a/src/core/core.h +++ b/src/core/core.h | |||
@@ -26,7 +26,6 @@ | |||
26 | #ifndef CORE_H | 26 | #ifndef CORE_H |
27 | #define CORE_H | 27 | #define CORE_H |
28 | 28 | ||
29 | #include "gnunet_transport_service.h" | ||
30 | #include "gnunet_util_lib.h" | 29 | #include "gnunet_util_lib.h" |
31 | #include "gnunet_time_lib.h" | 30 | #include "gnunet_time_lib.h" |
32 | 31 | ||
diff --git a/src/core/gnunet-service-core.c b/src/core/gnunet-service-core.c index c9c3e3ff5..e387fecc9 100644 --- a/src/core/gnunet-service-core.c +++ b/src/core/gnunet-service-core.c | |||
@@ -30,6 +30,7 @@ | |||
30 | #include "gnunet-service-core_kx.h" | 30 | #include "gnunet-service-core_kx.h" |
31 | #include "gnunet-service-core_sessions.h" | 31 | #include "gnunet-service-core_sessions.h" |
32 | #include "gnunet-service-core_typemap.h" | 32 | #include "gnunet-service-core_typemap.h" |
33 | #include "gnunet_constants.h" | ||
33 | 34 | ||
34 | /** | 35 | /** |
35 | * How many messages do we queue up at most for any client? This can | 36 | * How many messages do we queue up at most for any client? This can |
diff --git a/src/core/gnunet-service-core_kx.c b/src/core/gnunet-service-core_kx.c index b203f4902..774f967e3 100644 --- a/src/core/gnunet-service-core_kx.c +++ b/src/core/gnunet-service-core_kx.c | |||
@@ -26,14 +26,12 @@ | |||
26 | */ | 26 | */ |
27 | #include "platform.h" | 27 | #include "platform.h" |
28 | #include "gnunet-service-core_kx.h" | 28 | #include "gnunet-service-core_kx.h" |
29 | #include "gnunet-service-core.h" | 29 | #include "gnunet_transport_core_service.h" |
30 | #include "gnunet-service-core_sessions.h" | 30 | #include "gnunet-service-core_sessions.h" |
31 | #include "gnunet_statistics_service.h" | 31 | #include "gnunet-service-core.h" |
32 | #include "gnunet_transport_service.h" | ||
33 | #include "gnunet_constants.h" | 32 | #include "gnunet_constants.h" |
34 | #include "gnunet_signatures.h" | 33 | #include "gnunet_signatures.h" |
35 | #include "gnunet_protocols.h" | 34 | #include "gnunet_protocols.h" |
36 | #include "core.h" | ||
37 | 35 | ||
38 | /** | 36 | /** |
39 | * Enable expensive (and possibly problematic for privacy!) logging of KX. | 37 | * Enable expensive (and possibly problematic for privacy!) logging of KX. |
@@ -1678,28 +1676,6 @@ handle_encrypted (void *cls, const struct EncryptedMessage *m) | |||
1678 | 1676 | ||
1679 | 1677 | ||
1680 | /** | 1678 | /** |
1681 | * One of our neighbours has excess bandwidth, remember this. | ||
1682 | * | ||
1683 | * @param cls NULL | ||
1684 | * @param pid identity of the peer with excess bandwidth | ||
1685 | * @param connect_cls the `struct Neighbour` | ||
1686 | */ | ||
1687 | static void | ||
1688 | handle_transport_notify_excess_bw (void *cls, | ||
1689 | const struct GNUNET_PeerIdentity *pid, | ||
1690 | void *connect_cls) | ||
1691 | { | ||
1692 | struct GSC_KeyExchangeInfo *kx = connect_cls; | ||
1693 | |||
1694 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
1695 | "Peer %s has excess bandwidth available\n", | ||
1696 | GNUNET_i2s (pid)); | ||
1697 | kx->has_excess_bandwidth = GNUNET_YES; | ||
1698 | GSC_SESSIONS_solicit (pid); | ||
1699 | } | ||
1700 | |||
1701 | |||
1702 | /** | ||
1703 | * Setup the message that links the ephemeral key to our persistent | 1679 | * Setup the message that links the ephemeral key to our persistent |
1704 | * public key and generate the appropriate signature. | 1680 | * public key and generate the appropriate signature. |
1705 | */ | 1681 | */ |
@@ -1835,8 +1811,7 @@ GSC_KX_init (struct GNUNET_CRYPTO_EddsaPrivateKey *pk) | |||
1835 | handlers, | 1811 | handlers, |
1836 | NULL, | 1812 | NULL, |
1837 | &handle_transport_notify_connect, | 1813 | &handle_transport_notify_connect, |
1838 | &handle_transport_notify_disconnect, | 1814 | &handle_transport_notify_disconnect); |
1839 | &handle_transport_notify_excess_bw); | ||
1840 | if (NULL == transport) | 1815 | if (NULL == transport) |
1841 | { | 1816 | { |
1842 | GSC_KX_done (); | 1817 | GSC_KX_done (); |
diff --git a/src/core/gnunet-service-core_kx.h b/src/core/gnunet-service-core_kx.h index 77f3e43b6..8bcac3f68 100644 --- a/src/core/gnunet-service-core_kx.h +++ b/src/core/gnunet-service-core_kx.h | |||
@@ -27,7 +27,6 @@ | |||
27 | #define GNUNET_SERVICE_CORE_KX_H | 27 | #define GNUNET_SERVICE_CORE_KX_H |
28 | 28 | ||
29 | #include "gnunet_util_lib.h" | 29 | #include "gnunet_util_lib.h" |
30 | #include "gnunet_transport_service.h" | ||
31 | 30 | ||
32 | 31 | ||
33 | /** | 32 | /** |
diff --git a/src/core/gnunet-service-core_typemap.c b/src/core/gnunet-service-core_typemap.c index 7b7df2fe9..200a84b23 100644 --- a/src/core/gnunet-service-core_typemap.c +++ b/src/core/gnunet-service-core_typemap.c | |||
@@ -25,7 +25,6 @@ | |||
25 | */ | 25 | */ |
26 | #include "platform.h" | 26 | #include "platform.h" |
27 | #include "gnunet_util_lib.h" | 27 | #include "gnunet_util_lib.h" |
28 | #include "gnunet_transport_service.h" | ||
29 | #include "gnunet-service-core.h" | 28 | #include "gnunet-service-core.h" |
30 | #include "gnunet-service-core_sessions.h" | 29 | #include "gnunet-service-core_sessions.h" |
31 | #include "gnunet-service-core_typemap.h" | 30 | #include "gnunet-service-core_typemap.h" |
diff --git a/src/core/gnunet-service-core_typemap.h b/src/core/gnunet-service-core_typemap.h index 7acdec53b..de41f4220 100644 --- a/src/core/gnunet-service-core_typemap.h +++ b/src/core/gnunet-service-core_typemap.h | |||
@@ -27,7 +27,6 @@ | |||
27 | #define GNUNET_SERVICE_CORE_TYPEMAP_H | 27 | #define GNUNET_SERVICE_CORE_TYPEMAP_H |
28 | 28 | ||
29 | #include "gnunet_util_lib.h" | 29 | #include "gnunet_util_lib.h" |
30 | #include "gnunet_transport_service.h" | ||
31 | 30 | ||
32 | /** | 31 | /** |
33 | * Map specifying which message types a peer supports. | 32 | * Map specifying which message types a peer supports. |
diff --git a/src/dht/gnunet-service-dht.h b/src/dht/gnunet-service-dht.h index dcc972fc2..893c90109 100644 --- a/src/dht/gnunet-service-dht.h +++ b/src/dht/gnunet-service-dht.h | |||
@@ -29,7 +29,6 @@ | |||
29 | #include "gnunet-service-dht_datacache.h" | 29 | #include "gnunet-service-dht_datacache.h" |
30 | #include "gnunet-service-dht_neighbours.h" | 30 | #include "gnunet-service-dht_neighbours.h" |
31 | #include "gnunet_statistics_service.h" | 31 | #include "gnunet_statistics_service.h" |
32 | #include "gnunet_transport_service.h" | ||
33 | 32 | ||
34 | 33 | ||
35 | #define DEBUG_DHT GNUNET_EXTRA_LOGGING | 34 | #define DEBUG_DHT GNUNET_EXTRA_LOGGING |
diff --git a/src/dhtu/Makefile.am b/src/dhtu/Makefile.am index 4d210b71f..3a3e1c192 100644 --- a/src/dhtu/Makefile.am +++ b/src/dhtu/Makefile.am | |||
@@ -37,6 +37,7 @@ libgnunet_plugin_dhtu_gnunet_la_LIBADD = \ | |||
37 | $(top_builddir)/src/core/libgnunetcore.la \ | 37 | $(top_builddir)/src/core/libgnunetcore.la \ |
38 | $(top_builddir)/src/peerinfo/libgnunetpeerinfo.la \ | 38 | $(top_builddir)/src/peerinfo/libgnunetpeerinfo.la \ |
39 | $(top_builddir)/src/transport/libgnunettransport.la \ | 39 | $(top_builddir)/src/transport/libgnunettransport.la \ |
40 | $(top_builddir)/src/transport/libgnunettransportapplication.la \ | ||
40 | $(top_builddir)/src/hello/libgnunethello.la \ | 41 | $(top_builddir)/src/hello/libgnunethello.la \ |
41 | $(top_builddir)/src/nse/libgnunetnse.la \ | 42 | $(top_builddir)/src/nse/libgnunetnse.la \ |
42 | $(top_builddir)/src/util/libgnunetutil.la \ | 43 | $(top_builddir)/src/util/libgnunetutil.la \ |
diff --git a/src/dhtu/plugin_dhtu_gnunet.c b/src/dhtu/plugin_dhtu_gnunet.c index b0cee7e01..6a79e70f3 100644 --- a/src/dhtu/plugin_dhtu_gnunet.c +++ b/src/dhtu/plugin_dhtu_gnunet.c | |||
@@ -26,43 +26,14 @@ | |||
26 | */ | 26 | */ |
27 | #include "platform.h" | 27 | #include "platform.h" |
28 | #include "gnunet_dhtu_plugin.h" | 28 | #include "gnunet_dhtu_plugin.h" |
29 | #include "gnunet_ats_service.h" | ||
30 | #include "gnunet_core_service.h" | 29 | #include "gnunet_core_service.h" |
31 | #include "gnunet_transport_service.h" | 30 | #include "gnunet_transport_application_service.h" |
32 | #include "gnunet_hello_lib.h" | 31 | #include "gnunet_hello_lib.h" |
33 | #include "gnunet_peerinfo_service.h" | 32 | #include "gnunet_peerinfo_service.h" |
34 | #include "gnunet_nse_service.h" | 33 | #include "gnunet_nse_service.h" |
35 | 34 | ||
36 | 35 | ||
37 | /** | 36 | /** |
38 | * Handle for a HELLO we're offering the transport. | ||
39 | */ | ||
40 | struct HelloHandle | ||
41 | { | ||
42 | /** | ||
43 | * Kept in a DLL. | ||
44 | */ | ||
45 | struct HelloHandle *next; | ||
46 | |||
47 | /** | ||
48 | * Kept in a DLL. | ||
49 | */ | ||
50 | struct HelloHandle *prev; | ||
51 | |||
52 | /** | ||
53 | * Our plugin. | ||
54 | */ | ||
55 | struct Plugin *plugin; | ||
56 | |||
57 | /** | ||
58 | * Offer handle. | ||
59 | */ | ||
60 | struct GNUNET_TRANSPORT_OfferHelloHandle *ohh; | ||
61 | |||
62 | }; | ||
63 | |||
64 | |||
65 | /** | ||
66 | * Opaque handle that the underlay offers for our address to be used when | 37 | * Opaque handle that the underlay offers for our address to be used when |
67 | * sending messages to another peer. | 38 | * sending messages to another peer. |
68 | */ | 39 | */ |
@@ -110,9 +81,9 @@ struct GNUNET_DHTU_Target | |||
110 | struct GNUNET_DHTU_PreferenceHandle *ph_tail; | 81 | struct GNUNET_DHTU_PreferenceHandle *ph_tail; |
111 | 82 | ||
112 | /** | 83 | /** |
113 | * ATS preference handle for this peer, or NULL. | 84 | * Transport suggest handle. |
114 | */ | 85 | */ |
115 | struct GNUNET_ATS_ConnectivitySuggestHandle *csh; | 86 | struct GNUNET_TRANSPORT_ApplicationSuggestHandle *ash; |
116 | 87 | ||
117 | /** | 88 | /** |
118 | * Identity of this peer. | 89 | * Identity of this peer. |
@@ -173,9 +144,9 @@ struct Plugin | |||
173 | struct GNUNET_CORE_Handle *core; | 144 | struct GNUNET_CORE_Handle *core; |
174 | 145 | ||
175 | /** | 146 | /** |
176 | * Handle to ATS service. | 147 | * Handle to Transport service. |
177 | */ | 148 | */ |
178 | struct GNUNET_ATS_ConnectivityHandle *ats; | 149 | struct GNUNET_TRANSPORT_ApplicationHandle *transport; |
179 | 150 | ||
180 | /** | 151 | /** |
181 | * Handle to the NSE service. | 152 | * Handle to the NSE service. |
@@ -188,16 +159,6 @@ struct Plugin | |||
188 | struct GNUNET_PEERINFO_NotifyContext *nc; | 159 | struct GNUNET_PEERINFO_NotifyContext *nc; |
189 | 160 | ||
190 | /** | 161 | /** |
191 | * Hellos we are offering to transport. | ||
192 | */ | ||
193 | struct HelloHandle *hh_head; | ||
194 | |||
195 | /** | ||
196 | * Hellos we are offering to transport. | ||
197 | */ | ||
198 | struct HelloHandle *hh_tail; | ||
199 | |||
200 | /** | ||
201 | * Identity of this peer. | 162 | * Identity of this peer. |
202 | */ | 163 | */ |
203 | struct GNUNET_PeerIdentity my_identity; | 164 | struct GNUNET_PeerIdentity my_identity; |
@@ -205,24 +166,6 @@ struct Plugin | |||
205 | }; | 166 | }; |
206 | 167 | ||
207 | 168 | ||
208 | /** | ||
209 | * Function called once a hello offer is completed. | ||
210 | * | ||
211 | * @param cls a `struct HelloHandle` | ||
212 | */ | ||
213 | static void | ||
214 | hello_offered_cb (void *cls) | ||
215 | { | ||
216 | struct HelloHandle *hh = cls; | ||
217 | struct Plugin *plugin = hh->plugin; | ||
218 | |||
219 | GNUNET_CONTAINER_DLL_remove (plugin->hh_head, | ||
220 | plugin->hh_tail, | ||
221 | hh); | ||
222 | GNUNET_free (hh); | ||
223 | } | ||
224 | |||
225 | |||
226 | #include "../peerinfo-tool/gnunet-peerinfo_plugins.c" | 169 | #include "../peerinfo-tool/gnunet-peerinfo_plugins.c" |
227 | 170 | ||
228 | 171 | ||
@@ -239,27 +182,12 @@ gnunet_try_connect (void *cls, | |||
239 | const char *address) | 182 | const char *address) |
240 | { | 183 | { |
241 | struct Plugin *plugin = cls; | 184 | struct Plugin *plugin = cls; |
242 | struct GNUNET_HELLO_Message *hello = NULL; | 185 | enum GNUNET_NetworkType nt = 0; |
243 | struct HelloHandle *hh; | 186 | |
244 | struct GNUNET_CRYPTO_EddsaPublicKey pubkey; | 187 | GNUNET_TRANSPORT_application_validate (plugin->transport, |
245 | 188 | pid, | |
246 | (void) pid; /* will be needed with future address URIs */ | 189 | nt, |
247 | if (GNUNET_OK != | 190 | address); |
248 | GNUNET_HELLO_parse_uri (address, | ||
249 | &pubkey, | ||
250 | &hello, | ||
251 | &GPI_plugins_find)) | ||
252 | return; | ||
253 | hh = GNUNET_new (struct HelloHandle); | ||
254 | hh->plugin = plugin; | ||
255 | GNUNET_CONTAINER_DLL_insert (plugin->hh_head, | ||
256 | plugin->hh_tail, | ||
257 | hh); | ||
258 | hh->ohh = GNUNET_TRANSPORT_offer_hello (plugin->env->cfg, | ||
259 | &hello->header, | ||
260 | &hello_offered_cb, | ||
261 | hh); | ||
262 | GNUNET_free (hello); | ||
263 | } | 191 | } |
264 | 192 | ||
265 | 193 | ||
@@ -277,6 +205,7 @@ gnunet_hold (void *cls, | |||
277 | { | 205 | { |
278 | struct Plugin *plugin = cls; | 206 | struct Plugin *plugin = cls; |
279 | struct GNUNET_DHTU_PreferenceHandle *ph; | 207 | struct GNUNET_DHTU_PreferenceHandle *ph; |
208 | struct GNUNET_BANDWIDTH_Value32NBO bw; | ||
280 | 209 | ||
281 | ph = GNUNET_new (struct GNUNET_DHTU_PreferenceHandle); | 210 | ph = GNUNET_new (struct GNUNET_DHTU_PreferenceHandle); |
282 | ph->target = target; | 211 | ph->target = target; |
@@ -284,12 +213,13 @@ gnunet_hold (void *cls, | |||
284 | target->ph_tail, | 213 | target->ph_tail, |
285 | ph); | 214 | ph); |
286 | target->ph_count++; | 215 | target->ph_count++; |
287 | if (NULL != target->csh) | 216 | if (NULL != target->ash) |
288 | GNUNET_ATS_connectivity_suggest_cancel (target->csh); | 217 | GNUNET_TRANSPORT_application_suggest_cancel (target->ash); |
289 | target->csh | 218 | target->ash |
290 | = GNUNET_ATS_connectivity_suggest (plugin->ats, | 219 | = GNUNET_TRANSPORT_application_suggest (plugin->transport, |
291 | &target->pid, | 220 | &target->pid, |
292 | target->ph_count); | 221 | GNUNET_MQ_PRIO_BEST_EFFORT, |
222 | bw); | ||
293 | return ph; | 223 | return ph; |
294 | } | 224 | } |
295 | 225 | ||
@@ -305,21 +235,23 @@ gnunet_drop (struct GNUNET_DHTU_PreferenceHandle *ph) | |||
305 | { | 235 | { |
306 | struct GNUNET_DHTU_Target *target = ph->target; | 236 | struct GNUNET_DHTU_Target *target = ph->target; |
307 | struct Plugin *plugin = target->plugin; | 237 | struct Plugin *plugin = target->plugin; |
238 | struct GNUNET_BANDWIDTH_Value32NBO bw; | ||
308 | 239 | ||
309 | GNUNET_CONTAINER_DLL_remove (target->ph_head, | 240 | GNUNET_CONTAINER_DLL_remove (target->ph_head, |
310 | target->ph_tail, | 241 | target->ph_tail, |
311 | ph); | 242 | ph); |
312 | target->ph_count--; | 243 | target->ph_count--; |
313 | GNUNET_free (ph); | 244 | GNUNET_free (ph); |
314 | if (NULL != target->csh) | 245 | if (NULL != target->ash) |
315 | GNUNET_ATS_connectivity_suggest_cancel (target->csh); | 246 | GNUNET_TRANSPORT_application_suggest_cancel (target->ash); |
316 | if (0 == target->ph_count) | 247 | if (0 == target->ph_count) |
317 | target->csh = NULL; | 248 | target->ash = NULL; |
318 | else | 249 | else |
319 | target->csh | 250 | target->ash |
320 | = GNUNET_ATS_connectivity_suggest (plugin->ats, | 251 | = GNUNET_TRANSPORT_application_suggest (plugin->transport, |
321 | &target->pid, | 252 | &target->pid, |
322 | target->ph_count); | 253 | GNUNET_MQ_PRIO_BEST_EFFORT, |
254 | bw); | ||
323 | } | 255 | } |
324 | 256 | ||
325 | 257 | ||
@@ -408,8 +340,8 @@ core_disconnect_cb (void *cls, | |||
408 | struct GNUNET_DHTU_Target *target = peer_cls; | 340 | struct GNUNET_DHTU_Target *target = peer_cls; |
409 | 341 | ||
410 | plugin->env->disconnect_cb (target->app_ctx); | 342 | plugin->env->disconnect_cb (target->app_ctx); |
411 | if (NULL != target->csh) | 343 | if (NULL != target->ash) |
412 | GNUNET_ATS_connectivity_suggest_cancel (target->csh); | 344 | GNUNET_TRANSPORT_application_suggest_cancel (target->ash); |
413 | GNUNET_free (target); | 345 | GNUNET_free (target); |
414 | } | 346 | } |
415 | 347 | ||
@@ -556,14 +488,6 @@ libgnunet_plugin_dhtu_gnunet_done (void *cls) | |||
556 | struct Plugin *plugin = api->cls; | 488 | struct Plugin *plugin = api->cls; |
557 | struct HelloHandle *hh; | 489 | struct HelloHandle *hh; |
558 | 490 | ||
559 | while (NULL != (hh = plugin->hh_head)) | ||
560 | { | ||
561 | GNUNET_CONTAINER_DLL_remove (plugin->hh_head, | ||
562 | plugin->hh_tail, | ||
563 | hh); | ||
564 | GNUNET_TRANSPORT_offer_hello_cancel (hh->ohh); | ||
565 | GNUNET_free (hh); | ||
566 | } | ||
567 | if (NULL != plugin->nse) | 491 | if (NULL != plugin->nse) |
568 | GNUNET_NSE_disconnect (plugin->nse); | 492 | GNUNET_NSE_disconnect (plugin->nse); |
569 | plugin->env->network_size_cb (plugin->env->cls, | 493 | plugin->env->network_size_cb (plugin->env->cls, |
@@ -572,8 +496,8 @@ libgnunet_plugin_dhtu_gnunet_done (void *cls) | |||
572 | 0.0); | 496 | 0.0); |
573 | if (NULL != plugin->core) | 497 | if (NULL != plugin->core) |
574 | GNUNET_CORE_disconnect (plugin->core); | 498 | GNUNET_CORE_disconnect (plugin->core); |
575 | if (NULL != plugin->ats) | 499 | if (NULL != plugin->transport) |
576 | GNUNET_ATS_connectivity_done (plugin->ats); | 500 | GNUNET_TRANSPORT_application_done (plugin->transport); |
577 | if (NULL != plugin->nc) | 501 | if (NULL != plugin->nc) |
578 | GNUNET_PEERINFO_notify_cancel (plugin->nc); | 502 | GNUNET_PEERINFO_notify_cancel (plugin->nc); |
579 | GPI_plugins_unload (); | 503 | GPI_plugins_unload (); |
@@ -611,7 +535,7 @@ libgnunet_plugin_dhtu_gnunet_init (void *cls) | |||
611 | api->hold = &gnunet_hold; | 535 | api->hold = &gnunet_hold; |
612 | api->drop = &gnunet_drop; | 536 | api->drop = &gnunet_drop; |
613 | api->send = &gnunet_send; | 537 | api->send = &gnunet_send; |
614 | plugin->ats = GNUNET_ATS_connectivity_init (env->cfg); | 538 | plugin->transport = GNUNET_TRANSPORT_application_init (env->cfg); |
615 | plugin->core = GNUNET_CORE_connect (env->cfg, | 539 | plugin->core = GNUNET_CORE_connect (env->cfg, |
616 | plugin, | 540 | plugin, |
617 | &core_init_cb, | 541 | &core_init_cb, |
@@ -621,7 +545,7 @@ libgnunet_plugin_dhtu_gnunet_init (void *cls) | |||
621 | plugin->nse = GNUNET_NSE_connect (env->cfg, | 545 | plugin->nse = GNUNET_NSE_connect (env->cfg, |
622 | &nse_cb, | 546 | &nse_cb, |
623 | plugin); | 547 | plugin); |
624 | if ( (NULL == plugin->ats) || | 548 | if ( (NULL == plugin->transport) || |
625 | (NULL == plugin->core) || | 549 | (NULL == plugin->core) || |
626 | (NULL == plugin->nse) ) | 550 | (NULL == plugin->nse) ) |
627 | { | 551 | { |
diff --git a/src/fs/gnunet-service-fs.c b/src/fs/gnunet-service-fs.c index 597e89e14..c4193c2e4 100644 --- a/src/fs/gnunet-service-fs.c +++ b/src/fs/gnunet-service-fs.c | |||
@@ -33,7 +33,6 @@ | |||
33 | #include "gnunet_protocols.h" | 33 | #include "gnunet_protocols.h" |
34 | #include "gnunet_signatures.h" | 34 | #include "gnunet_signatures.h" |
35 | #include "gnunet_statistics_service.h" | 35 | #include "gnunet_statistics_service.h" |
36 | #include "gnunet_transport_service.h" | ||
37 | #include "gnunet_util_lib.h" | 36 | #include "gnunet_util_lib.h" |
38 | #include "gnunet-service-fs_cp.h" | 37 | #include "gnunet-service-fs_cp.h" |
39 | #include "gnunet-service-fs_indexing.h" | 38 | #include "gnunet-service-fs_indexing.h" |
@@ -248,11 +247,6 @@ struct GNUNET_LOAD_Value *GSF_rt_entry_lifetime; | |||
248 | */ | 247 | */ |
249 | struct GNUNET_TIME_Relative GSF_avg_latency = { 500 }; | 248 | struct GNUNET_TIME_Relative GSF_avg_latency = { 500 }; |
250 | 249 | ||
251 | /** | ||
252 | * Handle to ATS service. | ||
253 | */ | ||
254 | struct GNUNET_ATS_PerformanceHandle *GSF_ats; | ||
255 | |||
256 | 250 | ||
257 | /** | 251 | /** |
258 | * Typical priorities we're seeing from other peers right now. Since | 252 | * Typical priorities we're seeing from other peers right now. Since |
@@ -1042,12 +1036,12 @@ hash_for_index_val (void *cls, | |||
1042 | GNUNET_h2s (&isc->file_id)); | 1036 | GNUNET_h2s (&isc->file_id)); |
1043 | 1037 | ||
1044 | const char *emsg = "hash mismatch"; | 1038 | const char *emsg = "hash mismatch"; |
1045 | const size_t msize = strlen(emsg) + 1; | 1039 | const size_t msize = strlen (emsg) + 1; |
1046 | 1040 | ||
1047 | env = GNUNET_MQ_msg_extra (msg, | 1041 | env = GNUNET_MQ_msg_extra (msg, |
1048 | msize, | 1042 | msize, |
1049 | GNUNET_MESSAGE_TYPE_FS_INDEX_START_FAILED); | 1043 | GNUNET_MESSAGE_TYPE_FS_INDEX_START_FAILED); |
1050 | memcpy((char*) &msg[1], emsg, msize); | 1044 | memcpy ((char*) &msg[1], emsg, msize); |
1051 | GNUNET_MQ_send (lc->mq, | 1045 | GNUNET_MQ_send (lc->mq, |
1052 | env); | 1046 | env); |
1053 | GNUNET_SERVICE_client_continue (lc->client); | 1047 | GNUNET_SERVICE_client_continue (lc->client); |
@@ -1182,11 +1176,6 @@ shutdown_task (void *cls) | |||
1182 | GNUNET_CORE_disconnect (GSF_core); | 1176 | GNUNET_CORE_disconnect (GSF_core); |
1183 | GSF_core = NULL; | 1177 | GSF_core = NULL; |
1184 | } | 1178 | } |
1185 | if (NULL != GSF_ats) | ||
1186 | { | ||
1187 | GNUNET_ATS_performance_done (GSF_ats); | ||
1188 | GSF_ats = NULL; | ||
1189 | } | ||
1190 | GSF_put_done_ (); | 1179 | GSF_put_done_ (); |
1191 | GSF_push_done_ (); | 1180 | GSF_push_done_ (); |
1192 | GSF_pending_request_done_ (); | 1181 | GSF_pending_request_done_ (); |
@@ -1378,9 +1367,7 @@ run (void *cls, | |||
1378 | GSF_plan_init (); | 1367 | GSF_plan_init (); |
1379 | GSF_pending_request_init_ (); | 1368 | GSF_pending_request_init_ (); |
1380 | GSF_connected_peer_init_ (); | 1369 | GSF_connected_peer_init_ (); |
1381 | GSF_ats = GNUNET_ATS_performance_init (GSF_cfg, | 1370 | |
1382 | &update_latencies, | ||
1383 | NULL); | ||
1384 | GSF_push_init_ (); | 1371 | GSF_push_init_ (); |
1385 | GSF_put_init_ (); | 1372 | GSF_put_init_ (); |
1386 | if ((GNUNET_OK != GNUNET_FS_indexing_init (cfg, | 1373 | if ((GNUNET_OK != GNUNET_FS_indexing_init (cfg, |
diff --git a/src/fs/gnunet-service-fs.h b/src/fs/gnunet-service-fs.h index 56d102673..7bbab1022 100644 --- a/src/fs/gnunet-service-fs.h +++ b/src/fs/gnunet-service-fs.h | |||
@@ -28,7 +28,6 @@ | |||
28 | 28 | ||
29 | #include "gnunet_util_lib.h" | 29 | #include "gnunet_util_lib.h" |
30 | #include "gnunet_statistics_service.h" | 30 | #include "gnunet_statistics_service.h" |
31 | #include "gnunet_transport_service.h" | ||
32 | #include "gnunet_core_service.h" | 31 | #include "gnunet_core_service.h" |
33 | #include "gnunet_block_lib.h" | 32 | #include "gnunet_block_lib.h" |
34 | #include "gnunet_ats_service.h" | 33 | #include "gnunet_ats_service.h" |
diff --git a/src/fs/gnunet-service-fs_cp.c b/src/fs/gnunet-service-fs_cp.c index 29e4c5910..74dd42daf 100644 --- a/src/fs/gnunet-service-fs_cp.c +++ b/src/fs/gnunet-service-fs_cp.c | |||
@@ -94,11 +94,6 @@ struct GSF_PeerTransmitHandle | |||
94 | int is_query; | 94 | int is_query; |
95 | 95 | ||
96 | /** | 96 | /** |
97 | * Did we get a reservation already? | ||
98 | */ | ||
99 | int was_reserved; | ||
100 | |||
101 | /** | ||
102 | * Priority of this request. | 97 | * Priority of this request. |
103 | */ | 98 | */ |
104 | uint32_t priority; | 99 | uint32_t priority; |
@@ -210,11 +205,6 @@ struct GSF_ConnectedPeer | |||
210 | struct GSF_DelayedHandle *delayed_tail; | 205 | struct GSF_DelayedHandle *delayed_tail; |
211 | 206 | ||
212 | /** | 207 | /** |
213 | * Context of our GNUNET_ATS_reserve_bandwidth call (or NULL). | ||
214 | */ | ||
215 | struct GNUNET_ATS_ReservationContext *rc; | ||
216 | |||
217 | /** | ||
218 | * Task scheduled if we need to retry bandwidth reservation later. | 208 | * Task scheduled if we need to retry bandwidth reservation later. |
219 | */ | 209 | */ |
220 | struct GNUNET_SCHEDULER_Task *rc_delay_task; | 210 | struct GNUNET_SCHEDULER_Task *rc_delay_task; |
@@ -264,12 +254,6 @@ struct GSF_ConnectedPeer | |||
264 | unsigned int last_request_times_off; | 254 | unsigned int last_request_times_off; |
265 | 255 | ||
266 | /** | 256 | /** |
267 | * #GNUNET_YES if we did successfully reserve 32k bandwidth, | ||
268 | * #GNUNET_NO if not. | ||
269 | */ | ||
270 | int did_reserve; | ||
271 | |||
272 | /** | ||
273 | * Handle to the PEERSTORE iterate request for peer respect value | 257 | * Handle to the PEERSTORE iterate request for peer respect value |
274 | */ | 258 | */ |
275 | struct GNUNET_PEERSTORE_IterateContext *respect_iterate_req; | 259 | struct GNUNET_PEERSTORE_IterateContext *respect_iterate_req; |
@@ -335,23 +319,6 @@ peer_transmit (struct GSF_ConnectedPeer *cp); | |||
335 | 319 | ||
336 | 320 | ||
337 | /** | 321 | /** |
338 | * Function called by core upon success or failure of our bandwidth reservation request. | ||
339 | * | ||
340 | * @param cls the `struct GSF_ConnectedPeer` of the peer for which we made the request | ||
341 | * @param peer identifies the peer | ||
342 | * @param amount set to the amount that was actually reserved or unreserved; | ||
343 | * either the full requested amount or zero (no partial reservations) | ||
344 | * @param res_delay if the reservation could not be satisfied (amount was 0), how | ||
345 | * long should the client wait until re-trying? | ||
346 | */ | ||
347 | static void | ||
348 | ats_reserve_callback (void *cls, | ||
349 | const struct GNUNET_PeerIdentity *peer, | ||
350 | int32_t amount, | ||
351 | struct GNUNET_TIME_Relative res_delay); | ||
352 | |||
353 | |||
354 | /** | ||
355 | * If ready (bandwidth reserved), try to schedule transmission via | 322 | * If ready (bandwidth reserved), try to schedule transmission via |
356 | * core for the given handle. | 323 | * core for the given handle. |
357 | * | 324 | * |
@@ -367,32 +334,6 @@ schedule_transmission (struct GSF_PeerTransmitHandle *pth) | |||
367 | GNUNET_assert (0 != cp->ppd.pid); | 334 | GNUNET_assert (0 != cp->ppd.pid); |
368 | GNUNET_PEER_resolve (cp->ppd.pid, &target); | 335 | GNUNET_PEER_resolve (cp->ppd.pid, &target); |
369 | 336 | ||
370 | if (0 != cp->inc_preference) | ||
371 | { | ||
372 | GNUNET_ATS_performance_change_preference (GSF_ats, | ||
373 | &target, | ||
374 | GNUNET_ATS_PREFERENCE_BANDWIDTH, | ||
375 | (double) cp->inc_preference, | ||
376 | GNUNET_ATS_PREFERENCE_END); | ||
377 | cp->inc_preference = 0; | ||
378 | } | ||
379 | |||
380 | if ((GNUNET_YES == pth->is_query) && | ||
381 | (GNUNET_YES != pth->was_reserved)) | ||
382 | { | ||
383 | /* query, need reservation */ | ||
384 | if (GNUNET_YES != cp->did_reserve) | ||
385 | return; /* not ready */ | ||
386 | cp->did_reserve = GNUNET_NO; | ||
387 | /* reservation already done! */ | ||
388 | pth->was_reserved = GNUNET_YES; | ||
389 | cp->rc = GNUNET_ATS_reserve_bandwidth (GSF_ats, | ||
390 | &target, | ||
391 | DBLOCK_SIZE, | ||
392 | &ats_reserve_callback, | ||
393 | cp); | ||
394 | return; | ||
395 | } | ||
396 | peer_transmit (cp); | 337 | peer_transmit (cp); |
397 | } | 338 | } |
398 | 339 | ||
@@ -439,69 +380,6 @@ peer_transmit (struct GSF_ConnectedPeer *cp) | |||
439 | 380 | ||
440 | 381 | ||
441 | /** | 382 | /** |
442 | * (re)try to reserve bandwidth from the given peer. | ||
443 | * | ||
444 | * @param cls the `struct GSF_ConnectedPeer` to reserve from | ||
445 | */ | ||
446 | static void | ||
447 | retry_reservation (void *cls) | ||
448 | { | ||
449 | struct GSF_ConnectedPeer *cp = cls; | ||
450 | struct GNUNET_PeerIdentity target; | ||
451 | |||
452 | GNUNET_PEER_resolve (cp->ppd.pid, &target); | ||
453 | cp->rc_delay_task = NULL; | ||
454 | cp->rc = | ||
455 | GNUNET_ATS_reserve_bandwidth (GSF_ats, | ||
456 | &target, | ||
457 | DBLOCK_SIZE, | ||
458 | &ats_reserve_callback, cp); | ||
459 | } | ||
460 | |||
461 | |||
462 | /** | ||
463 | * Function called by core upon success or failure of our bandwidth reservation request. | ||
464 | * | ||
465 | * @param cls the `struct GSF_ConnectedPeer` of the peer for which we made the request | ||
466 | * @param peer identifies the peer | ||
467 | * @param amount set to the amount that was actually reserved or unreserved; | ||
468 | * either the full requested amount or zero (no partial reservations) | ||
469 | * @param res_delay if the reservation could not be satisfied (amount was 0), how | ||
470 | * long should the client wait until re-trying? | ||
471 | */ | ||
472 | static void | ||
473 | ats_reserve_callback (void *cls, | ||
474 | const struct GNUNET_PeerIdentity *peer, | ||
475 | int32_t amount, | ||
476 | struct GNUNET_TIME_Relative res_delay) | ||
477 | { | ||
478 | struct GSF_ConnectedPeer *cp = cls; | ||
479 | struct GSF_PeerTransmitHandle *pth; | ||
480 | |||
481 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
482 | "Reserved %d bytes / need to wait %s for reservation\n", | ||
483 | (int) amount, | ||
484 | GNUNET_STRINGS_relative_time_to_string (res_delay, GNUNET_YES)); | ||
485 | cp->rc = NULL; | ||
486 | if (0 == amount) | ||
487 | { | ||
488 | cp->rc_delay_task = | ||
489 | GNUNET_SCHEDULER_add_delayed (res_delay, | ||
490 | &retry_reservation, | ||
491 | cp); | ||
492 | return; | ||
493 | } | ||
494 | cp->did_reserve = GNUNET_YES; | ||
495 | pth = cp->pth_head; | ||
496 | if (NULL != pth) | ||
497 | { | ||
498 | /* reservation success, try transmission now! */ | ||
499 | peer_transmit (cp); | ||
500 | } | ||
501 | } | ||
502 | |||
503 | |||
504 | /** | ||
505 | * Function called by PEERSTORE with peer respect record | 383 | * Function called by PEERSTORE with peer respect record |
506 | * | 384 | * |
507 | * @param cls handle to connected peer entry | 385 | * @param cls handle to connected peer entry |
@@ -584,11 +462,7 @@ GSF_peer_connect_handler (void *cls, | |||
584 | cp->ppd.peer = peer; | 462 | cp->ppd.peer = peer; |
585 | cp->mq = mq; | 463 | cp->mq = mq; |
586 | cp->ppd.transmission_delay = GNUNET_LOAD_value_init (GNUNET_TIME_UNIT_ZERO); | 464 | cp->ppd.transmission_delay = GNUNET_LOAD_value_init (GNUNET_TIME_UNIT_ZERO); |
587 | cp->rc = | 465 | |
588 | GNUNET_ATS_reserve_bandwidth (GSF_ats, | ||
589 | peer, | ||
590 | DBLOCK_SIZE, | ||
591 | &ats_reserve_callback, cp); | ||
592 | cp->request_map = GNUNET_CONTAINER_multihashmap_create (128, | 466 | cp->request_map = GNUNET_CONTAINER_multihashmap_create (128, |
593 | GNUNET_YES); | 467 | GNUNET_YES); |
594 | GNUNET_break (GNUNET_OK == | 468 | GNUNET_break (GNUNET_OK == |
@@ -1499,16 +1373,6 @@ GSF_peer_disconnect_handler (void *cls, | |||
1499 | GNUNET_PEERSTORE_iterate_cancel (cp->respect_iterate_req); | 1373 | GNUNET_PEERSTORE_iterate_cancel (cp->respect_iterate_req); |
1500 | cp->respect_iterate_req = NULL; | 1374 | cp->respect_iterate_req = NULL; |
1501 | } | 1375 | } |
1502 | if (NULL != cp->rc) | ||
1503 | { | ||
1504 | GNUNET_ATS_reserve_bandwidth_cancel (cp->rc); | ||
1505 | cp->rc = NULL; | ||
1506 | } | ||
1507 | if (NULL != cp->rc_delay_task) | ||
1508 | { | ||
1509 | GNUNET_SCHEDULER_cancel (cp->rc_delay_task); | ||
1510 | cp->rc_delay_task = NULL; | ||
1511 | } | ||
1512 | GNUNET_CONTAINER_multihashmap_iterate (cp->request_map, | 1376 | GNUNET_CONTAINER_multihashmap_iterate (cp->request_map, |
1513 | &cancel_pending_request, | 1377 | &cancel_pending_request, |
1514 | cp); | 1378 | cp); |
diff --git a/src/hostlist/gnunet-daemon-hostlist_client.c b/src/hostlist/gnunet-daemon-hostlist_client.c index 399a7dc39..2caf61a1b 100644 --- a/src/hostlist/gnunet-daemon-hostlist_client.c +++ b/src/hostlist/gnunet-daemon-hostlist_client.c | |||
@@ -27,7 +27,6 @@ | |||
27 | #include "gnunet-daemon-hostlist_client.h" | 27 | #include "gnunet-daemon-hostlist_client.h" |
28 | #include "gnunet_hello_lib.h" | 28 | #include "gnunet_hello_lib.h" |
29 | #include "gnunet_statistics_service.h" | 29 | #include "gnunet_statistics_service.h" |
30 | #include "gnunet_transport_service.h" | ||
31 | #include "gnunet_peerinfo_service.h" | 30 | #include "gnunet_peerinfo_service.h" |
32 | #include "gnunet-daemon-hostlist.h" | 31 | #include "gnunet-daemon-hostlist.h" |
33 | /* Just included for the right curl.h */ | 32 | /* Just included for the right curl.h */ |
diff --git a/src/include/gnunet_cadet_service.h b/src/include/gnunet_cadet_service.h index acc7bb330..ab53d2bd8 100644 --- a/src/include/gnunet_cadet_service.h +++ b/src/include/gnunet_cadet_service.h | |||
@@ -47,7 +47,6 @@ extern "C" { | |||
47 | 47 | ||
48 | 48 | ||
49 | #include "gnunet_util_lib.h" | 49 | #include "gnunet_util_lib.h" |
50 | #include "gnunet_transport_service.h" | ||
51 | 50 | ||
52 | /** | 51 | /** |
53 | * Version number of GNUnet-cadet API. | 52 | * Version number of GNUnet-cadet API. |
@@ -636,4 +635,3 @@ GNUNET_CADET_list_tunnels_cancel (struct GNUNET_CADET_ListTunnels *lt); | |||
636 | /** @} */ /* end of group addition */ | 635 | /** @} */ /* end of group addition */ |
637 | 636 | ||
638 | /* end of gnunet_cadet_service.h */ | 637 | /* end of gnunet_cadet_service.h */ |
639 | |||
diff --git a/src/include/gnunet_core_service.h b/src/include/gnunet_core_service.h index 4e188df87..c3069be81 100644 --- a/src/include/gnunet_core_service.h +++ b/src/include/gnunet_core_service.h | |||
@@ -45,7 +45,6 @@ extern "C" { | |||
45 | 45 | ||
46 | 46 | ||
47 | #include "gnunet_util_lib.h" | 47 | #include "gnunet_util_lib.h" |
48 | #include "gnunet_transport_service.h" | ||
49 | 48 | ||
50 | /** | 49 | /** |
51 | * Version number of GNUnet-core API. | 50 | * Version number of GNUnet-core API. |
diff --git a/src/rps/gnunet-service-rps.c b/src/rps/gnunet-service-rps.c index be9324af9..fc11591a0 100644 --- a/src/rps/gnunet-service-rps.c +++ b/src/rps/gnunet-service-rps.c | |||
@@ -36,6 +36,7 @@ | |||
36 | #include "gnunet-service-rps_sampler.h" | 36 | #include "gnunet-service-rps_sampler.h" |
37 | #include "gnunet-service-rps_custommap.h" | 37 | #include "gnunet-service-rps_custommap.h" |
38 | #include "gnunet-service-rps_view.h" | 38 | #include "gnunet-service-rps_view.h" |
39 | #include "gnunet_constants.h" | ||
39 | 40 | ||
40 | #include <math.h> | 41 | #include <math.h> |
41 | #include <inttypes.h> | 42 | #include <inttypes.h> |
diff --git a/src/scalarproduct/gnunet-service-scalarproduct-ecc_alice.c b/src/scalarproduct/gnunet-service-scalarproduct-ecc_alice.c index c43a7e854..b8bac0803 100644 --- a/src/scalarproduct/gnunet-service-scalarproduct-ecc_alice.c +++ b/src/scalarproduct/gnunet-service-scalarproduct-ecc_alice.c | |||
@@ -35,6 +35,7 @@ | |||
35 | #include "gnunet_seti_service.h" | 35 | #include "gnunet_seti_service.h" |
36 | #include "scalarproduct.h" | 36 | #include "scalarproduct.h" |
37 | #include "gnunet-service-scalarproduct-ecc.h" | 37 | #include "gnunet-service-scalarproduct-ecc.h" |
38 | #include "gnunet_constants.h" | ||
38 | 39 | ||
39 | #define LOG(kind, ...) \ | 40 | #define LOG(kind, ...) \ |
40 | GNUNET_log_from (kind, "scalarproduct-alice", __VA_ARGS__) | 41 | GNUNET_log_from (kind, "scalarproduct-alice", __VA_ARGS__) |
diff --git a/src/scalarproduct/gnunet-service-scalarproduct_alice.c b/src/scalarproduct/gnunet-service-scalarproduct_alice.c index 59c3c6f6c..0149f45ba 100644 --- a/src/scalarproduct/gnunet-service-scalarproduct_alice.c +++ b/src/scalarproduct/gnunet-service-scalarproduct_alice.c | |||
@@ -35,6 +35,7 @@ | |||
35 | #include "gnunet_seti_service.h" | 35 | #include "gnunet_seti_service.h" |
36 | #include "scalarproduct.h" | 36 | #include "scalarproduct.h" |
37 | #include "gnunet-service-scalarproduct.h" | 37 | #include "gnunet-service-scalarproduct.h" |
38 | #include "gnunet_constants.h" | ||
38 | 39 | ||
39 | #define LOG(kind, ...) \ | 40 | #define LOG(kind, ...) \ |
40 | GNUNET_log_from (kind, "scalarproduct-alice", __VA_ARGS__) | 41 | GNUNET_log_from (kind, "scalarproduct-alice", __VA_ARGS__) |
diff --git a/src/scalarproduct/gnunet-service-scalarproduct_bob.c b/src/scalarproduct/gnunet-service-scalarproduct_bob.c index 15ad3038e..65e732675 100644 --- a/src/scalarproduct/gnunet-service-scalarproduct_bob.c +++ b/src/scalarproduct/gnunet-service-scalarproduct_bob.c | |||
@@ -35,6 +35,7 @@ | |||
35 | #include "gnunet_seti_service.h" | 35 | #include "gnunet_seti_service.h" |
36 | #include "scalarproduct.h" | 36 | #include "scalarproduct.h" |
37 | #include "gnunet-service-scalarproduct.h" | 37 | #include "gnunet-service-scalarproduct.h" |
38 | #include "gnunet_constants.h" | ||
38 | 39 | ||
39 | #define LOG(kind, ...) GNUNET_log_from (kind, "scalarproduct-bob", __VA_ARGS__) | 40 | #define LOG(kind, ...) GNUNET_log_from (kind, "scalarproduct-bob", __VA_ARGS__) |
40 | 41 | ||
diff --git a/src/topology/Makefile.am b/src/topology/Makefile.am index e5920116b..682f052dd 100644 --- a/src/topology/Makefile.am +++ b/src/topology/Makefile.am | |||
@@ -36,6 +36,7 @@ gnunet_daemon_topology_LDADD = \ | |||
36 | $(top_builddir)/src/peerinfo/libgnunetpeerinfo.la \ | 36 | $(top_builddir)/src/peerinfo/libgnunetpeerinfo.la \ |
37 | $(top_builddir)/src/statistics/libgnunetstatistics.la \ | 37 | $(top_builddir)/src/statistics/libgnunetstatistics.la \ |
38 | $(top_builddir)/src/transport/libgnunettransport.la \ | 38 | $(top_builddir)/src/transport/libgnunettransport.la \ |
39 | $(top_builddir)/src/transport/libgnunettransportapplication.la \ | ||
39 | $(top_builddir)/src/ats/libgnunetats.la \ | 40 | $(top_builddir)/src/ats/libgnunetats.la \ |
40 | $(top_builddir)/src/hello/libgnunethello.la \ | 41 | $(top_builddir)/src/hello/libgnunethello.la \ |
41 | $(top_builddir)/src/util/libgnunetutil.la \ | 42 | $(top_builddir)/src/util/libgnunetutil.la \ |
diff --git a/src/topology/gnunet-daemon-topology.c b/src/topology/gnunet-daemon-topology.c index b380c0bd4..b43238923 100644 --- a/src/topology/gnunet-daemon-topology.c +++ b/src/topology/gnunet-daemon-topology.c | |||
@@ -44,10 +44,13 @@ | |||
44 | #include "gnunet_protocols.h" | 44 | #include "gnunet_protocols.h" |
45 | #include "gnunet_peerinfo_service.h" | 45 | #include "gnunet_peerinfo_service.h" |
46 | #include "gnunet_statistics_service.h" | 46 | #include "gnunet_statistics_service.h" |
47 | #include "gnunet_transport_service.h" | 47 | #include "gnunet_transport_application_service.h" |
48 | #include "gnunet_ats_service.h" | 48 | #include "gnunet_ats_service.h" |
49 | 49 | ||
50 | 50 | ||
51 | // TODO Remove all occurrencies of friends_only and minimum_friend_count. | ||
52 | |||
53 | |||
51 | /** | 54 | /** |
52 | * At what frequency do we sent HELLOs to a peer? | 55 | * At what frequency do we sent HELLOs to a peer? |
53 | */ | 56 | */ |
@@ -105,9 +108,9 @@ struct Peer | |||
105 | struct GNUNET_SCHEDULER_Task *hello_delay_task; | 108 | struct GNUNET_SCHEDULER_Task *hello_delay_task; |
106 | 109 | ||
107 | /** | 110 | /** |
108 | * Handle for our connectivity suggestion for this peer. | 111 | * Transport suggest handle. |
109 | */ | 112 | */ |
110 | struct GNUNET_ATS_ConnectivitySuggestHandle *sh; | 113 | struct GNUNET_TRANSPORT_ApplicationSuggestHandle *ash; |
111 | 114 | ||
112 | /** | 115 | /** |
113 | * How much would we like to connect to this peer? | 116 | * How much would we like to connect to this peer? |
@@ -143,9 +146,9 @@ static struct GNUNET_CORE_Handle *handle; | |||
143 | static struct GNUNET_PEERINFO_Handle *pi; | 146 | static struct GNUNET_PEERINFO_Handle *pi; |
144 | 147 | ||
145 | /** | 148 | /** |
146 | * Handle to the ATS service. | 149 | * Handle to Transport service. |
147 | */ | 150 | */ |
148 | static struct GNUNET_ATS_ConnectivityHandle *ats; | 151 | struct GNUNET_TRANSPORT_ApplicationHandle *transport; |
149 | 152 | ||
150 | /** | 153 | /** |
151 | * Identity of this peer. | 154 | * Identity of this peer. |
@@ -165,11 +168,6 @@ static struct GNUNET_CONTAINER_MultiPeerMap *peers; | |||
165 | static struct GNUNET_STATISTICS_Handle *stats; | 168 | static struct GNUNET_STATISTICS_Handle *stats; |
166 | 169 | ||
167 | /** | 170 | /** |
168 | * Blacklist (NULL if we have none). | ||
169 | */ | ||
170 | static struct GNUNET_TRANSPORT_Blacklist *blacklist; | ||
171 | |||
172 | /** | ||
173 | * Task scheduled to asynchronously reconsider adding/removing | 171 | * Task scheduled to asynchronously reconsider adding/removing |
174 | * peer connectivity suggestions. | 172 | * peer connectivity suggestions. |
175 | */ | 173 | */ |
@@ -233,21 +231,6 @@ blacklist_check (void *cls, const struct GNUNET_PeerIdentity *pid) | |||
233 | 231 | ||
234 | 232 | ||
235 | /** | 233 | /** |
236 | * Whitelist all peers that we blacklisted; we've passed | ||
237 | * the minimum number of friends. | ||
238 | */ | ||
239 | static void | ||
240 | whitelist_peers () | ||
241 | { | ||
242 | if (NULL != blacklist) | ||
243 | { | ||
244 | GNUNET_TRANSPORT_blacklist_cancel (blacklist); | ||
245 | blacklist = NULL; | ||
246 | } | ||
247 | } | ||
248 | |||
249 | |||
250 | /** | ||
251 | * Free all resources associated with the given peer. | 234 | * Free all resources associated with the given peer. |
252 | * | 235 | * |
253 | * @param cls closure (not used) | 236 | * @param cls closure (not used) |
@@ -268,10 +251,10 @@ free_peer (void *cls, const struct GNUNET_PeerIdentity *pid, void *value) | |||
268 | GNUNET_SCHEDULER_cancel (pos->hello_delay_task); | 251 | GNUNET_SCHEDULER_cancel (pos->hello_delay_task); |
269 | pos->hello_delay_task = NULL; | 252 | pos->hello_delay_task = NULL; |
270 | } | 253 | } |
271 | if (NULL != pos->sh) | 254 | if (NULL != pos->ash) |
272 | { | 255 | { |
273 | GNUNET_ATS_connectivity_suggest_cancel (pos->sh); | 256 | GNUNET_TRANSPORT_application_suggest_cancel (pos->ash); |
274 | pos->sh = NULL; | 257 | pos->ash = NULL; |
275 | } | 258 | } |
276 | if (NULL != pos->hello) | 259 | if (NULL != pos->hello) |
277 | { | 260 | { |
@@ -298,6 +281,7 @@ static void | |||
298 | attempt_connect (struct Peer *pos) | 281 | attempt_connect (struct Peer *pos) |
299 | { | 282 | { |
300 | uint32_t strength; | 283 | uint32_t strength; |
284 | struct GNUNET_BANDWIDTH_Value32NBO bw; | ||
301 | 285 | ||
302 | if (0 == GNUNET_memcmp (&my_identity, &pos->pid)) | 286 | if (0 == GNUNET_memcmp (&my_identity, &pos->pid)) |
303 | return; /* This is myself, nothing to do. */ | 287 | return; /* This is myself, nothing to do. */ |
@@ -318,10 +302,10 @@ attempt_connect (struct Peer *pos) | |||
318 | strength *= 2; /* existing connections preferred */ | 302 | strength *= 2; /* existing connections preferred */ |
319 | if (strength == pos->strength) | 303 | if (strength == pos->strength) |
320 | return; /* nothing to do */ | 304 | return; /* nothing to do */ |
321 | if (NULL != pos->sh) | 305 | if (NULL != pos->ash) |
322 | { | 306 | { |
323 | GNUNET_ATS_connectivity_suggest_cancel (pos->sh); | 307 | GNUNET_TRANSPORT_application_suggest_cancel (pos->ash); |
324 | pos->sh = NULL; | 308 | pos->ash = NULL; |
325 | } | 309 | } |
326 | pos->strength = strength; | 310 | pos->strength = strength; |
327 | if (0 != strength) | 311 | if (0 != strength) |
@@ -334,7 +318,10 @@ attempt_connect (struct Peer *pos) | |||
334 | gettext_noop ("# connect requests issued to ATS"), | 318 | gettext_noop ("# connect requests issued to ATS"), |
335 | 1, | 319 | 1, |
336 | GNUNET_NO); | 320 | GNUNET_NO); |
337 | pos->sh = GNUNET_ATS_connectivity_suggest (ats, &pos->pid, strength); | 321 | pos->ash = GNUNET_TRANSPORT_application_suggest (transport, |
322 | &pos->pid, | ||
323 | GNUNET_MQ_PRIO_BEST_EFFORT, | ||
324 | bw); | ||
338 | } | 325 | } |
339 | } | 326 | } |
340 | 327 | ||
@@ -592,8 +579,7 @@ connect_notify (void *cls, | |||
592 | if (pos->is_friend) | 579 | if (pos->is_friend) |
593 | { | 580 | { |
594 | friend_count++; | 581 | friend_count++; |
595 | if ((friend_count == minimum_friend_count) && (GNUNET_YES != friends_only)) | 582 | |
596 | whitelist_peers (); | ||
597 | GNUNET_STATISTICS_set (stats, | 583 | GNUNET_STATISTICS_set (stats, |
598 | gettext_noop ("# friends connected"), | 584 | gettext_noop ("# friends connected"), |
599 | friend_count, | 585 | friend_count, |
@@ -683,8 +669,7 @@ disconnect_notify (void *cls, | |||
683 | (friend_count < minimum_friend_count)) && | 669 | (friend_count < minimum_friend_count)) && |
684 | (NULL == add_task)) | 670 | (NULL == add_task)) |
685 | add_task = GNUNET_SCHEDULER_add_now (&add_peer_task, NULL); | 671 | add_task = GNUNET_SCHEDULER_add_now (&add_peer_task, NULL); |
686 | if ((friend_count < minimum_friend_count) && (NULL == blacklist)) | 672 | |
687 | blacklist = GNUNET_TRANSPORT_blacklist (cfg, &blacklist_check, NULL); | ||
688 | } | 673 | } |
689 | 674 | ||
690 | 675 | ||
@@ -1003,24 +988,18 @@ cleaning_task (void *cls) | |||
1003 | GNUNET_CORE_disconnect (handle); | 988 | GNUNET_CORE_disconnect (handle); |
1004 | handle = NULL; | 989 | handle = NULL; |
1005 | } | 990 | } |
1006 | whitelist_peers (); | ||
1007 | if (NULL != add_task) | 991 | if (NULL != add_task) |
1008 | { | 992 | { |
1009 | GNUNET_SCHEDULER_cancel (add_task); | 993 | GNUNET_SCHEDULER_cancel (add_task); |
1010 | add_task = NULL; | 994 | add_task = NULL; |
1011 | } | 995 | } |
1012 | if (NULL != oh) | ||
1013 | { | ||
1014 | GNUNET_TRANSPORT_offer_hello_cancel (oh); | ||
1015 | oh = NULL; | ||
1016 | } | ||
1017 | GNUNET_CONTAINER_multipeermap_iterate (peers, &free_peer, NULL); | 996 | GNUNET_CONTAINER_multipeermap_iterate (peers, &free_peer, NULL); |
1018 | GNUNET_CONTAINER_multipeermap_destroy (peers); | 997 | GNUNET_CONTAINER_multipeermap_destroy (peers); |
1019 | peers = NULL; | 998 | peers = NULL; |
1020 | if (NULL != ats) | 999 | if (NULL != transport) |
1021 | { | 1000 | { |
1022 | GNUNET_ATS_connectivity_done (ats); | 1001 | GNUNET_TRANSPORT_application_done (transport); |
1023 | ats = NULL; | 1002 | transport = NULL; |
1024 | } | 1003 | } |
1025 | if (NULL != pi) | 1004 | if (NULL != pi) |
1026 | { | 1005 | { |
@@ -1059,14 +1038,8 @@ run (void *cls, | |||
1059 | 1038 | ||
1060 | cfg = c; | 1039 | cfg = c; |
1061 | stats = GNUNET_STATISTICS_create ("topology", cfg); | 1040 | stats = GNUNET_STATISTICS_create ("topology", cfg); |
1062 | friends_only = | 1041 | |
1063 | GNUNET_CONFIGURATION_get_value_yesno (cfg, "TOPOLOGY", "FRIENDS-ONLY"); | 1042 | minimum_friend_count = 0; |
1064 | if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_number (cfg, | ||
1065 | "TOPOLOGY", | ||
1066 | "MINIMUM-FRIENDS", | ||
1067 | &opt)) | ||
1068 | opt = 0; | ||
1069 | minimum_friend_count = (unsigned int) opt; | ||
1070 | if (GNUNET_OK != | 1043 | if (GNUNET_OK != |
1071 | GNUNET_CONFIGURATION_get_value_number (cfg, | 1044 | GNUNET_CONFIGURATION_get_value_number (cfg, |
1072 | "TOPOLOGY", | 1045 | "TOPOLOGY", |
@@ -1081,9 +1054,8 @@ run (void *cls, | |||
1081 | "Topology would like %u connections with at least %u friends\n", | 1054 | "Topology would like %u connections with at least %u friends\n", |
1082 | target_connection_count, | 1055 | target_connection_count, |
1083 | minimum_friend_count); | 1056 | minimum_friend_count); |
1084 | if ((GNUNET_YES == friends_only) || (minimum_friend_count > 0)) | 1057 | |
1085 | blacklist = GNUNET_TRANSPORT_blacklist (cfg, &blacklist_check, NULL); | 1058 | transport = GNUNET_TRANSPORT_application_init (cfg); |
1086 | ats = GNUNET_ATS_connectivity_init (cfg); | ||
1087 | pi = GNUNET_PEERINFO_connect (cfg); | 1059 | pi = GNUNET_PEERINFO_connect (cfg); |
1088 | handle = GNUNET_CORE_connect (cfg, | 1060 | handle = GNUNET_CORE_connect (cfg, |
1089 | NULL, | 1061 | NULL, |