2 This file is part of GNUnet.
3 (C) 2008, 2009, 2010, 2014 Christian Grothoff (and other contributing authors)
5 GNUnet is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published
7 by the Free Software Foundation; either version 3, or (at your
8 option) any later version.
10 GNUnet is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with GNUnet; see the file COPYING. If not, write to the
17 Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 Boston, MA 02111-1307, USA.
22 * @file hostlist/gnunet-daemon-hostlist_server.c
23 * @author Christian Grothoff
24 * @author Matthias Wachs
25 * @author David Barksdale
26 * @brief application to provide an integrated hostlist HTTP server
29 #include <microhttpd.h>
30 #include "gnunet-daemon-hostlist_server.h"
31 #include "gnunet_hello_lib.h"
32 #include "gnunet_peerinfo_service.h"
33 #include "gnunet-daemon-hostlist.h"
34 #include "gnunet_resolver_service.h"
38 * How long until our hostlist advertisment transmission via CORE should
41 #define GNUNET_ADV_TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MINUTES, 5)
45 * Handle to the HTTP server as provided by libmicrohttpd for IPv6.
47 static struct MHD_Daemon *daemon_handle_v6;
50 * Handle to the HTTP server as provided by libmicrohttpd for IPv4.
52 static struct MHD_Daemon *daemon_handle_v4;
57 static const struct GNUNET_CONFIGURATION_Handle *cfg;
60 * For keeping statistics.
62 static struct GNUNET_STATISTICS_Handle *stats;
65 * Handle to the core service (NULL until we've connected to it).
67 static struct GNUNET_CORE_Handle *core;
70 * Handle to the peerinfo notify service (NULL until we've connected to it).
72 static struct GNUNET_PEERINFO_NotifyContext *notify;
75 * Our primary task for IPv4.
77 static GNUNET_SCHEDULER_TaskIdentifier hostlist_task_v4;
80 * Our primary task for IPv6.
82 static GNUNET_SCHEDULER_TaskIdentifier hostlist_task_v6;
85 * Our canonical response.
87 static struct MHD_Response *response;
90 * Handle for accessing peerinfo service.
92 static struct GNUNET_PEERINFO_Handle *peerinfo;
95 * Set if we are allowed to advertise our hostlist to others.
97 static int advertising;
100 * Buffer for the hostlist address
102 static char *hostlist_uri;
106 * Context for host processor.
114 struct GNUNET_PEERINFO_IteratorContext *pitr;
119 * NULL if we are not currenlty iterating over peer information.
121 static struct HostSet *builder;
125 * Function that assembles our response.
130 if (NULL != response)
131 MHD_destroy_response (response);
132 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
133 "Creating hostlist response with %u bytes\n",
134 (unsigned int) builder->size);
136 MHD_create_response_from_data (builder->size, builder->data, MHD_YES,
138 if ((NULL == daemon_handle_v4) && (NULL == daemon_handle_v6))
140 MHD_destroy_response (response);
143 GNUNET_STATISTICS_set (stats, gettext_noop ("bytes in hostlist"),
144 builder->size, GNUNET_YES);
145 GNUNET_free (builder);
151 * Set @a cls to #GNUNET_YES (we have an address!).
153 * @param cls closure, an `int *`
154 * @param address the address (ignored)
155 * @param expiration expiration time (call is ignored if this is in the past)
156 * @return #GNUNET_SYSERR to stop iterating (unless expiration has occured)
159 check_has_addr (void *cls,
160 const struct GNUNET_HELLO_Address *address,
161 struct GNUNET_TIME_Absolute expiration)
165 if (0 == GNUNET_TIME_absolute_get_remaining (expiration).rel_value_us)
167 GNUNET_STATISTICS_update (stats,
168 gettext_noop ("expired addresses encountered"), 1,
170 return GNUNET_YES; /* ignore this address */
173 return GNUNET_SYSERR;
178 * Callback that processes each of the known HELLOs for the
179 * hostlist response construction.
181 * @param cls closure, NULL
182 * @param peer id of the peer, NULL for last call
183 * @param hello hello message for the peer (can be NULL)
184 * @param error message
187 host_processor (void *cls,
188 const struct GNUNET_PeerIdentity *peer,
189 const struct GNUNET_HELLO_Message *hello,
198 GNUNET_assert (NULL == peer);
199 builder->pitr = NULL;
200 GNUNET_free_non_null (builder->data);
201 GNUNET_free (builder);
202 GNUNET_log (GNUNET_ERROR_TYPE_INFO,
203 _("Error in communication with PEERINFO service: %s\n"),
209 builder->pitr = NULL;
215 has_addr = GNUNET_NO;
216 GNUNET_HELLO_iterate_addresses (hello,
220 if (GNUNET_NO == has_addr)
222 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
223 "HELLO for peer `%4s' has no address, not suitable for hostlist!\n",
225 GNUNET_STATISTICS_update (stats,
227 ("HELLOs without addresses encountered (ignored)"),
232 s = GNUNET_HELLO_size (hello);
233 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
234 "Received %u bytes of `%s' from peer `%s' for hostlist.\n",
238 if ((old + s >= GNUNET_MAX_MALLOC_CHECKED) ||
239 (old + s >= MAX_BYTES_PER_HOSTLISTS))
241 GNUNET_STATISTICS_update (stats,
243 ("bytes not included in hostlist (size limit)"),
245 return; /* too large, skip! */
247 GNUNET_log (GNUNET_ERROR_TYPE_INFO,
248 "Adding peer `%s' to hostlist (%u bytes)\n",
251 GNUNET_array_grow (builder->data, builder->size, old + s);
252 memcpy (&builder->data[old], hello, s);
257 * Hostlist access policy (very permissive, allows everything).
258 * Returns #MHD_NO only if we are not yet ready to serve.
261 * @param addr address information from the client
262 * @param addrlen length of @a addr
263 * @return #MHD_YES if connection is allowed, #MHD_NO if not (we are not ready)
266 accept_policy_callback (void *cls,
267 const struct sockaddr *addr,
270 if (NULL == response)
272 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
273 "Received request for hostlist, but I am not yet ready; rejecting!\n");
276 return MHD_YES; /* accept all */
281 * Add headers to a request indicating that we allow Cross-Origin Resource
284 * @param response response to add headers to
287 add_cors_headers (struct MHD_Response *response)
289 MHD_add_response_header (response,
290 "Access-Control-Allow-Origin",
292 MHD_add_response_header (response,
293 "Access-Control-Allow-Methods",
295 MHD_add_response_header (response,
296 "Access-Control-Max-Age",
302 * Main request handler.
304 * @param cls argument given together with the function
305 * pointer when the handler was registered with MHD
306 * @param url the requested url
307 * @param method the HTTP method used (#MHD_HTTP_METHOD_GET,
308 * #MHD_HTTP_METHOD_PUT, etc.)
309 * @param version the HTTP version string (i.e.
310 * #MHD_HTTP_VERSION_1_1)
311 * @param upload_data the data being uploaded (excluding HEADERS,
312 * for a POST that fits into memory and that is encoded
313 * with a supported encoding, the POST data will NOT be
314 * given in upload_data and is instead available as
315 * part of #MHD_get_connection_values; very large POST
316 * data *will* be made available incrementally in
318 * @param upload_data_size set initially to the size of the
319 * @a upload_data provided; the method must update this
320 * value to the number of bytes NOT processed;
321 * @param con_cls pointer that the callback can set to some
322 * address and that will be preserved by MHD for future
323 * calls for this request; since the access handler may
324 * be called many times (i.e., for a PUT/POST operation
325 * with plenty of upload data) this allows the application
326 * to easily associate some request-specific state.
327 * If necessary, this state can be cleaned up in the
328 * global #MHD_RequestCompletedCallback (which
329 * can be set with the #MHD_OPTION_NOTIFY_COMPLETED).
330 * Initially, `*con_cls` will be NULL.
331 * @return #MHD_YES if the connection was handled successfully,
332 * #MHD_NO if the socket must be closed due to a serios
333 * error while handling the request
336 access_handler_callback (void *cls,
337 struct MHD_Connection *connection,
341 const char *upload_data,
342 size_t *upload_data_size,
347 /* CORS pre-flight request */
348 if (0 == strcmp (MHD_HTTP_METHOD_OPTIONS, method))
350 struct MHD_Response *options_response;
353 options_response = MHD_create_response_from_buffer (0, NULL,
354 MHD_RESPMEM_PERSISTENT);
355 add_cors_headers(options_response);
356 rc = MHD_queue_response (connection, MHD_HTTP_OK, options_response);
357 MHD_destroy_response (options_response);
360 if (0 != strcmp (method, MHD_HTTP_METHOD_GET))
362 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
363 _("Refusing `%s' request to hostlist server\n"), method);
364 GNUNET_STATISTICS_update (stats,
366 ("hostlist requests refused (not HTTP GET)"), 1,
370 if (NULL == *con_cls)
373 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
374 "Sending 100 CONTINUE reply\n");
375 return MHD_YES; /* send 100 continue */
377 if (0 != *upload_data_size)
379 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
380 _("Refusing `%s' request with %llu bytes of upload data\n"),
381 method, (unsigned long long) *upload_data_size);
382 GNUNET_STATISTICS_update (stats,
384 ("hostlist requests refused (upload data)"), 1,
386 return MHD_NO; /* do not support upload data */
388 if (NULL == response)
390 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
391 _("Could not handle hostlist request since I do not have a response yet\n"));
392 GNUNET_STATISTICS_update (stats,
394 ("hostlist requests refused (not ready)"), 1,
396 return MHD_NO; /* internal error, no response yet */
398 GNUNET_log (GNUNET_ERROR_TYPE_INFO,
399 _("Received request for our hostlist\n"));
400 GNUNET_STATISTICS_update (stats,
401 gettext_noop ("hostlist requests processed"),
403 add_cors_headers (response);
404 return MHD_queue_response (connection, MHD_HTTP_OK, response);
409 * Handler called by CORE when CORE is ready to transmit message
412 * @param size size of buffer to copy message to
413 * @param buf buffer to copy message to
414 * @return number of bytes copied to @a buf
417 adv_transmit_ready (void *cls,
421 static uint64_t hostlist_adv_count;
422 size_t transmission_size;
423 size_t uri_size; /* Including \0 termination! */
424 struct GNUNET_MessageHeader header;
429 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
430 "Transmission failed, buffer invalid!\n");
433 uri_size = strlen (hostlist_uri) + 1;
434 transmission_size = sizeof (struct GNUNET_MessageHeader) + uri_size;
435 header.type = htons (GNUNET_MESSAGE_TYPE_HOSTLIST_ADVERTISEMENT);
436 header.size = htons (transmission_size);
437 GNUNET_assert (size >= transmission_size);
438 memcpy (buf, &header, sizeof (struct GNUNET_MessageHeader));
440 memcpy (&cbuf[sizeof (struct GNUNET_MessageHeader)], hostlist_uri, uri_size);
441 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
442 "Sent advertisement message: Copied %u bytes into buffer!\n",
443 (unsigned int) transmission_size);
444 hostlist_adv_count++;
445 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " # Sent advertisement message: %u\n",
447 GNUNET_STATISTICS_update (stats,
448 gettext_noop ("# hostlist advertisements send"), 1,
450 return transmission_size;
455 * Method called whenever a given peer connects.
458 * @param peer peer identity this notification is about
461 connect_handler (void *cls,
462 const struct GNUNET_PeerIdentity *peer)
468 if (NULL == hostlist_uri)
470 size = strlen (hostlist_uri) + 1;
471 if (size + sizeof (struct GNUNET_MessageHeader) >=
472 GNUNET_SERVER_MAX_MESSAGE_SIZE)
477 size += sizeof (struct GNUNET_MessageHeader);
483 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
484 "Asked CORE to transmit advertisement message with a size of %u bytes to peer `%s'\n",
488 GNUNET_CORE_notify_transmit_ready (core, GNUNET_YES,
489 GNUNET_CORE_PRIO_BEST_EFFORT,
493 &adv_transmit_ready, NULL))
495 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
496 _("Advertisement message could not be queued by core\n"));
502 * Method called whenever a given peer disconnects.
505 * @param peer peer identity this notification is about
508 disconnect_handler (void *cls,
509 const struct GNUNET_PeerIdentity *peer)
516 * PEERINFO calls this function to let us know about a possible peer
517 * that we might want to connect to.
519 * @param cls closure (not used)
520 * @param peer potential peer to connect to
521 * @param hello HELLO for this peer (or NULL)
522 * @param err_msg NULL if successful, otherwise contains error message
525 process_notify (void *cls,
526 const struct GNUNET_PeerIdentity *peer,
527 const struct GNUNET_HELLO_Message *hello,
530 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
531 "Peerinfo is notifying us to rebuild our hostlist\n");
533 GNUNET_log (GNUNET_ERROR_TYPE_INFO,
534 _("Error in communication with PEERINFO service: %s\n"),
538 /* restart re-build already in progress ... */
539 if (NULL != builder->pitr)
541 GNUNET_PEERINFO_iterate_cancel (builder->pitr);
542 builder->pitr = NULL;
544 GNUNET_free_non_null (builder->data);
546 builder->data = NULL;
550 builder = GNUNET_new (struct HostSet);
552 GNUNET_assert (NULL != peerinfo);
554 GNUNET_PEERINFO_iterate (peerinfo, GNUNET_NO, NULL, GNUNET_TIME_UNIT_MINUTES,
555 &host_processor, NULL);
560 * Function that queries MHD's select sets and
561 * starts the task waiting for them.
563 static GNUNET_SCHEDULER_TaskIdentifier
564 prepare_daemon (struct MHD_Daemon *daemon_handle);
568 * Call MHD to process pending requests and then go back
569 * and schedule the next run.
571 * @param cls the `struct MHD_Daemon` of the HTTP server to run
572 * @param tc scheduler context
575 run_daemon (void *cls,
576 const struct GNUNET_SCHEDULER_TaskContext *tc)
578 struct MHD_Daemon *daemon_handle = cls;
580 if (daemon_handle == daemon_handle_v4)
581 hostlist_task_v4 = GNUNET_SCHEDULER_NO_TASK;
583 hostlist_task_v6 = GNUNET_SCHEDULER_NO_TASK;
585 if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN))
587 GNUNET_assert (MHD_YES == MHD_run (daemon_handle));
588 if (daemon_handle == daemon_handle_v4)
589 hostlist_task_v4 = prepare_daemon (daemon_handle);
591 hostlist_task_v6 = prepare_daemon (daemon_handle);
596 * Function that queries MHD's select sets and
597 * starts the task waiting for them.
599 * @param daemon_handle HTTP server to prepare to run
601 static GNUNET_SCHEDULER_TaskIdentifier
602 prepare_daemon (struct MHD_Daemon *daemon_handle)
604 GNUNET_SCHEDULER_TaskIdentifier ret;
608 struct GNUNET_NETWORK_FDSet *wrs;
609 struct GNUNET_NETWORK_FDSet *wws;
611 MHD_UNSIGNED_LONG_LONG timeout;
613 struct GNUNET_TIME_Relative tv;
618 wrs = GNUNET_NETWORK_fdset_create ();
619 wws = GNUNET_NETWORK_fdset_create ();
621 GNUNET_assert (MHD_YES == MHD_get_fdset (daemon_handle, &rs, &ws, &es, &max));
622 haveto = MHD_get_timeout (daemon_handle, &timeout);
623 if (haveto == MHD_YES)
624 tv.rel_value_us = (uint64_t) timeout * 1000LL;
626 tv = GNUNET_TIME_UNIT_FOREVER_REL;
627 GNUNET_NETWORK_fdset_copy_native (wrs, &rs, max + 1);
628 GNUNET_NETWORK_fdset_copy_native (wws, &ws, max + 1);
630 GNUNET_SCHEDULER_add_select (GNUNET_SCHEDULER_PRIORITY_HIGH,
632 &run_daemon, daemon_handle);
633 GNUNET_NETWORK_fdset_destroy (wrs);
634 GNUNET_NETWORK_fdset_destroy (wws);
640 * Start server offering our hostlist.
642 * @param c configuration to use
643 * @param st statistics handle to use
644 * @param co core handle to use
645 * @param server_ch[OUT] set to handler for CORE connect events
646 * @param server_dh[OUT] set to handler for CORE disconnect events
647 * @param advertise #GNUNET_YES if we should advertise our hostlist
648 * @return #GNUNET_OK on success
651 GNUNET_HOSTLIST_server_start (const struct GNUNET_CONFIGURATION_Handle *c,
652 struct GNUNET_STATISTICS_Handle *st,
653 struct GNUNET_CORE_Handle *co,
654 GNUNET_CORE_ConnectEventHandler *server_ch,
655 GNUNET_CORE_DisconnectEventHandler *server_dh,
658 unsigned long long port;
665 struct sockaddr_in v4;
666 struct sockaddr_in6 v6;
667 const struct sockaddr *sa4;
668 const struct sockaddr *sa6;
670 advertising = advertise;
672 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
673 "Advertising not enabled on this hostlist server\n");
675 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
676 "Advertising enabled on this hostlist server\n");
679 peerinfo = GNUNET_PEERINFO_connect (cfg);
680 if (NULL == peerinfo)
682 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
683 _("Could not access PEERINFO service. Exiting.\n"));
684 return GNUNET_SYSERR;
687 GNUNET_CONFIGURATION_get_value_number (cfg,
691 return GNUNET_SYSERR;
692 if ((0 == port) || (port > UINT16_MAX))
694 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
695 _("Invalid port number %llu. Exiting.\n"),
697 return GNUNET_SYSERR;
701 GNUNET_CONFIGURATION_get_value_string (cfg,
705 hostname = GNUNET_RESOLVER_local_fqdn_get ();
706 GNUNET_log (GNUNET_ERROR_TYPE_INFO,
707 _("Hostlist service starts on %s:%llu\n"),
709 if (NULL != hostname)
711 size = strlen (hostname);
712 if (size + 15 > MAX_URL_LEN)
718 GNUNET_asprintf (&hostlist_uri,
719 "http://%s:%u/", hostname,
720 (unsigned int) port);
721 GNUNET_log (GNUNET_ERROR_TYPE_INFO,
722 _("Address to obtain hostlist: `%s'\n"),
725 GNUNET_free (hostname);
728 if (GNUNET_CONFIGURATION_have_value (cfg, "HOSTLIST", "BINDTOIPV4"))
730 GNUNET_break (GNUNET_OK ==
731 GNUNET_CONFIGURATION_get_value_string (cfg, "HOSTLIST",
736 if (GNUNET_CONFIGURATION_have_value (cfg, "HOSTLIST", "BINDTOIPV6"))
738 GNUNET_break (GNUNET_OK ==
739 GNUNET_CONFIGURATION_get_value_string (cfg, "HOSTLIST",
747 if (1 == inet_pton (AF_INET, ipv4, &i4))
749 memset (&v4, 0, sizeof (v4));
750 v4.sin_family = AF_INET;
752 v4.sin_port = htons (port);
753 #if HAVE_SOCKADDR_IN_SIN_LEN
754 v4.sin_len = sizeof (v4);
756 sa4 = (const struct sockaddr *) &v4;
759 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
760 _("`%s' is not a valid IPv4 address! Ignoring BINDTOIPV4.\n"),
767 if (1 == inet_pton (AF_INET6, ipv6, &i6))
769 memset (&v6, 0, sizeof (v6));
770 v6.sin6_family = AF_INET6;
772 v6.sin6_port = htons (port);
773 #if HAVE_SOCKADDR_IN_SIN_LEN
774 v6.sin6_len = sizeof (v6);
776 sa6 = (const struct sockaddr *) &v6;
779 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
780 _("`%s' is not a valid IPv6 address! Ignoring BINDTOIPV6.\n"),
785 daemon_handle_v6 = MHD_start_daemon (MHD_USE_IPv6 | MHD_USE_DEBUG,
787 &accept_policy_callback, NULL,
788 &access_handler_callback, NULL,
789 MHD_OPTION_CONNECTION_LIMIT,
791 MHD_OPTION_PER_IP_CONNECTION_LIMIT,
793 MHD_OPTION_CONNECTION_TIMEOUT,
795 MHD_OPTION_CONNECTION_MEMORY_LIMIT,
796 (size_t) (16 * 1024),
797 MHD_OPTION_SOCK_ADDR,
800 daemon_handle_v4 = MHD_start_daemon (MHD_NO_FLAG | MHD_USE_DEBUG,
802 &accept_policy_callback, NULL,
803 &access_handler_callback, NULL,
804 MHD_OPTION_CONNECTION_LIMIT,
806 MHD_OPTION_PER_IP_CONNECTION_LIMIT,
808 MHD_OPTION_CONNECTION_TIMEOUT,
810 MHD_OPTION_CONNECTION_MEMORY_LIMIT,
811 (size_t) (16 * 1024),
812 MHD_OPTION_SOCK_ADDR,
816 if ( (NULL == daemon_handle_v6) &&
817 (NULL == daemon_handle_v4) )
819 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
820 _("Could not start hostlist HTTP server on port %u\n"),
821 (unsigned short) port);
822 return GNUNET_SYSERR;
826 *server_ch = &connect_handler;
827 *server_dh = &disconnect_handler;
828 if (NULL != daemon_handle_v4)
829 hostlist_task_v4 = prepare_daemon (daemon_handle_v4);
830 if (NULL != daemon_handle_v6)
831 hostlist_task_v6 = prepare_daemon (daemon_handle_v6);
832 notify = GNUNET_PEERINFO_notify (cfg, GNUNET_NO,
833 &process_notify, NULL);
839 * Stop server offering our hostlist.
842 GNUNET_HOSTLIST_server_stop ()
844 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Hostlist server shutdown\n");
845 if (GNUNET_SCHEDULER_NO_TASK != hostlist_task_v6)
847 GNUNET_SCHEDULER_cancel (hostlist_task_v6);
848 hostlist_task_v6 = GNUNET_SCHEDULER_NO_TASK;
850 if (GNUNET_SCHEDULER_NO_TASK != hostlist_task_v4)
852 GNUNET_SCHEDULER_cancel (hostlist_task_v4);
853 hostlist_task_v4 = GNUNET_SCHEDULER_NO_TASK;
855 if (NULL != daemon_handle_v4)
857 MHD_stop_daemon (daemon_handle_v4);
858 daemon_handle_v4 = NULL;
860 if (NULL != daemon_handle_v6)
862 MHD_stop_daemon (daemon_handle_v6);
863 daemon_handle_v6 = NULL;
865 if (NULL != response)
867 MHD_destroy_response (response);
872 GNUNET_PEERINFO_notify_cancel (notify);
877 if (NULL != builder->pitr)
879 GNUNET_PEERINFO_iterate_cancel (builder->pitr);
880 builder->pitr = NULL;
882 GNUNET_free_non_null (builder->data);
883 GNUNET_free (builder);
885 if (NULL != peerinfo)
887 GNUNET_PEERINFO_disconnect (peerinfo);
895 /* end of gnunet-daemon-hostlist_server.c */