#include "gnunet_hello_lib.h"
#include "gnunet_statistics_service.h"
#include "gnunet_transport_service.h"
+#include "gnunet_peerinfo_service.h"
#include "gnunet-daemon-hostlist.h"
#if HAVE_CURL_CURL_H
#include <curl/curl.h>
};
-struct HelloOffer
-{
- struct HelloOffer *next;
- struct HelloOffer *prev;
- struct GNUNET_TRANSPORT_OfferHelloHandle *ohh;
-};
-
-
/**
* Our configuration.
*/
*/
static unsigned int stat_connection_count;
-static struct HelloOffer *ho_head;
-
-static struct HelloOffer *ho_tail;
-
-
/**
- * Hello offer complete. Clean up.
+ * Handle to peerinfo service.
*/
-static void
-done_offer_hello (void *cls)
-{
- struct HelloOffer *ho = cls;
-
- GNUNET_CONTAINER_DLL_remove (ho_head,
- ho_tail,
- ho);
- GNUNET_free (ho);
-}
+static struct GNUNET_PEERINFO_Handle *pi;
/**
static char download_buffer[GNUNET_MAX_MESSAGE_SIZE - 1];
const char *cbuf = ptr;
const struct GNUNET_MessageHeader *msg;
- struct HelloOffer *ho;
size_t total;
size_t cpy;
size_t left;
("# valid HELLOs downloaded from hostlist servers"),
1, GNUNET_NO);
stat_hellos_obtained++;
-
- ho = GNUNET_new (struct HelloOffer);
- ho->ohh = GNUNET_TRANSPORT_offer_hello (cfg,
- msg,
- &done_offer_hello,
- ho);
- if (NULL == ho->ohh)
- {
- GNUNET_free (ho);
- }
- else
- {
- GNUNET_CONTAINER_DLL_insert (ho_head,
- ho_tail,
- ho);
- }
+ (void) GNUNET_PEERINFO_add_peer (pi,
+ (const struct GNUNET_HELLO_Message *) msg,
+ NULL,
+ NULL);
}
else
{
stats = st;
/* Read proxy configuration */
+ pi = GNUNET_PEERINFO_connect (c);
if (GNUNET_OK ==
GNUNET_CONFIGURATION_get_value_string (cfg,
"HOSTLIST",
void
GNUNET_HOSTLIST_client_stop ()
{
- struct HelloOffer *ho;
-
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Hostlist client shutdown\n");
- while (NULL != (ho = ho_head))
- {
- GNUNET_CONTAINER_DLL_remove (ho_head,
- ho_tail,
- ho);
- GNUNET_TRANSPORT_offer_hello_cancel (ho->ohh);
- GNUNET_free (ho);
- }
if (NULL != sget)
{
GNUNET_STATISTICS_get_cancel (sget);
proxy_username = NULL;
GNUNET_free_non_null (proxy_password);
proxy_password = NULL;
-
+ if (NULL != pi)
+ {
+ GNUNET_PEERINFO_disconnect (pi);
+ pi = NULL;
+ }
cfg = NULL;
}