diff options
Diffstat (limited to 'src/cadet/gnunet-service-cadet_peer.c')
-rw-r--r-- | src/cadet/gnunet-service-cadet_peer.c | 39 |
1 files changed, 10 insertions, 29 deletions
diff --git a/src/cadet/gnunet-service-cadet_peer.c b/src/cadet/gnunet-service-cadet_peer.c index fa16db4bb..101b9e22a 100644 --- a/src/cadet/gnunet-service-cadet_peer.c +++ b/src/cadet/gnunet-service-cadet_peer.c | |||
@@ -245,14 +245,14 @@ static unsigned long long drop_percent; | |||
245 | static struct GNUNET_CORE_Handle *core_handle; | 245 | static struct GNUNET_CORE_Handle *core_handle; |
246 | 246 | ||
247 | /** | 247 | /** |
248 | * Handle to communicate with ATS. | 248 | * Our configuration; |
249 | */ | 249 | */ |
250 | static struct GNUNET_ATS_ConnectivityHandle *ats_ch; | 250 | static const struct GNUNET_CONFIGURATION_Handle *cfg; |
251 | 251 | ||
252 | /** | 252 | /** |
253 | * Handle to try to start new connections. | 253 | * Handle to communicate with ATS. |
254 | */ | 254 | */ |
255 | static struct GNUNET_TRANSPORT_Handle *transport_handle; | 255 | static struct GNUNET_ATS_ConnectivityHandle *ats_ch; |
256 | 256 | ||
257 | /** | 257 | /** |
258 | * Shutdown falg. | 258 | * Shutdown falg. |
@@ -557,6 +557,7 @@ core_init (void *cls, | |||
557 | const struct GNUNET_CONFIGURATION_Handle *c = cls; | 557 | const struct GNUNET_CONFIGURATION_Handle *c = cls; |
558 | static int i = 0; | 558 | static int i = 0; |
559 | 559 | ||
560 | cfg = c; | ||
560 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Core init\n"); | 561 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Core init\n"); |
561 | if (0 != memcmp (identity, &my_full_id, sizeof (my_full_id))) | 562 | if (0 != memcmp (identity, &my_full_id, sizeof (my_full_id))) |
562 | { | 563 | { |
@@ -1841,24 +1842,6 @@ GCP_init (const struct GNUNET_CONFIGURATION_Handle *c) | |||
1841 | NULL, /* Don't notify about all outbound messages */ | 1842 | NULL, /* Don't notify about all outbound messages */ |
1842 | GNUNET_NO, /* For header-only out notification */ | 1843 | GNUNET_NO, /* For header-only out notification */ |
1843 | core_handlers); /* Register these handlers */ | 1844 | core_handlers); /* Register these handlers */ |
1844 | if (GNUNET_YES != | ||
1845 | GNUNET_CONFIGURATION_get_value_yesno (c, "CADET", "DISABLE_TRY_CONNECT")) | ||
1846 | { | ||
1847 | transport_handle = GNUNET_TRANSPORT_connect (c, &my_full_id, NULL, /* cls */ | ||
1848 | /* Notify callbacks */ | ||
1849 | NULL, NULL, NULL); | ||
1850 | } | ||
1851 | else | ||
1852 | { | ||
1853 | LOG (GNUNET_ERROR_TYPE_WARNING, "**************************************\n"); | ||
1854 | LOG (GNUNET_ERROR_TYPE_WARNING, "* DISABLE TRYING CONNECT in config *\n"); | ||
1855 | LOG (GNUNET_ERROR_TYPE_WARNING, "* Use this only for test purposes. *\n"); | ||
1856 | LOG (GNUNET_ERROR_TYPE_WARNING, "**************************************\n"); | ||
1857 | transport_handle = NULL; | ||
1858 | } | ||
1859 | |||
1860 | |||
1861 | |||
1862 | if (NULL == core_handle) | 1845 | if (NULL == core_handle) |
1863 | { | 1846 | { |
1864 | GNUNET_break (0); | 1847 | GNUNET_break (0); |
@@ -1886,11 +1869,6 @@ GCP_shutdown (void) | |||
1886 | GNUNET_CORE_disconnect (core_handle); | 1869 | GNUNET_CORE_disconnect (core_handle); |
1887 | core_handle = NULL; | 1870 | core_handle = NULL; |
1888 | } | 1871 | } |
1889 | if (NULL != transport_handle) | ||
1890 | { | ||
1891 | GNUNET_TRANSPORT_disconnect (transport_handle); | ||
1892 | transport_handle = NULL; | ||
1893 | } | ||
1894 | if (NULL != ats_ch) | 1872 | if (NULL != ats_ch) |
1895 | { | 1873 | { |
1896 | GNUNET_ATS_connectivity_done (ats_ch); | 1874 | GNUNET_ATS_connectivity_done (ats_ch); |
@@ -2591,7 +2569,10 @@ GCP_try_connect (struct CadetPeer *peer) | |||
2591 | struct GNUNET_HELLO_Message *hello; | 2569 | struct GNUNET_HELLO_Message *hello; |
2592 | struct GNUNET_MessageHeader *mh; | 2570 | struct GNUNET_MessageHeader *mh; |
2593 | 2571 | ||
2594 | if (NULL == transport_handle) | 2572 | if (GNUNET_YES != |
2573 | GNUNET_CONFIGURATION_get_value_yesno (cfg, | ||
2574 | "CADET", | ||
2575 | "DISABLE_TRY_CONNECT")) | ||
2595 | return; | 2576 | return; |
2596 | GCC_check_connections (); | 2577 | GCC_check_connections (); |
2597 | if (GNUNET_YES == GCP_is_neighbor (peer)) | 2578 | if (GNUNET_YES == GCP_is_neighbor (peer)) |
@@ -2606,7 +2587,7 @@ GCP_try_connect (struct CadetPeer *peer) | |||
2606 | GNUNET_TRANSPORT_offer_hello_cancel (peer->hello_offer); | 2587 | GNUNET_TRANSPORT_offer_hello_cancel (peer->hello_offer); |
2607 | peer->hello_offer = NULL; | 2588 | peer->hello_offer = NULL; |
2608 | } | 2589 | } |
2609 | peer->hello_offer = GNUNET_TRANSPORT_offer_hello (transport_handle, | 2590 | peer->hello_offer = GNUNET_TRANSPORT_offer_hello (cfg, |
2610 | mh, | 2591 | mh, |
2611 | &hello_offer_done, | 2592 | &hello_offer_done, |
2612 | peer); | 2593 | peer); |