diff options
Diffstat (limited to 'src/hostlist')
-rw-r--r-- | src/hostlist/gnunet-daemon-hostlist.c | 18 | ||||
-rw-r--r-- | src/hostlist/gnunet-daemon-hostlist.h | 18 | ||||
-rw-r--r-- | src/hostlist/gnunet-daemon-hostlist_client.c | 83 | ||||
-rw-r--r-- | src/hostlist/gnunet-daemon-hostlist_client.h | 18 | ||||
-rw-r--r-- | src/hostlist/gnunet-daemon-hostlist_server.c | 18 | ||||
-rw-r--r-- | src/hostlist/gnunet-daemon-hostlist_server.h | 18 | ||||
-rw-r--r-- | src/hostlist/test_gnunet_daemon_hostlist.c | 18 | ||||
-rw-r--r-- | src/hostlist/test_gnunet_daemon_hostlist_learning.c | 18 | ||||
-rw-r--r-- | src/hostlist/test_gnunet_daemon_hostlist_reconnect.c | 18 |
9 files changed, 85 insertions, 142 deletions
diff --git a/src/hostlist/gnunet-daemon-hostlist.c b/src/hostlist/gnunet-daemon-hostlist.c index 854340d3d5..31259b8295 100644 --- a/src/hostlist/gnunet-daemon-hostlist.c +++ b/src/hostlist/gnunet-daemon-hostlist.c @@ -2,20 +2,18 @@ This file is part of GNUnet. Copyright (C) 2007, 2008, 2009, 2014 GNUnet e.V. - GNUnet is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published - by the Free Software Foundation; either version 3, or (at your - option) any later version. + GNUnet is free software: you can redistribute it and/or modify it + under the terms of the GNU Affero General Public License as published + by the Free Software Foundation, either version 3 of the License, + or (at your option) any later version. GNUnet is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - General Public License for more details. - - You should have received a copy of the GNU General Public License - along with GNUnet; see the file COPYING. If not, write to the - Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. + Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ /** diff --git a/src/hostlist/gnunet-daemon-hostlist.h b/src/hostlist/gnunet-daemon-hostlist.h index f19815b457..e94c9da264 100644 --- a/src/hostlist/gnunet-daemon-hostlist.h +++ b/src/hostlist/gnunet-daemon-hostlist.h @@ -2,20 +2,18 @@ This file is part of GNUnet. Copyright (C) 2009 GNUnet e.V. - GNUnet is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published - by the Free Software Foundation; either version 3, or (at your - option) any later version. + GNUnet is free software: you can redistribute it and/or modify it + under the terms of the GNU Affero General Public License as published + by the Free Software Foundation, either version 3 of the License, + or (at your option) any later version. GNUnet is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - General Public License for more details. - - You should have received a copy of the GNU General Public License - along with GNUnet; see the file COPYING. If not, write to the - Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. + Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ /** diff --git a/src/hostlist/gnunet-daemon-hostlist_client.c b/src/hostlist/gnunet-daemon-hostlist_client.c index 207cc4a811..43b4e45931 100644 --- a/src/hostlist/gnunet-daemon-hostlist_client.c +++ b/src/hostlist/gnunet-daemon-hostlist_client.c @@ -2,20 +2,18 @@ This file is part of GNUnet. Copyright (C) 2001-2010, 2014, 2016 GNUnet e.V. - GNUnet is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published - by the Free Software Foundation; either version 3, or (at your - option) any later version. + GNUnet is free software: you can redistribute it and/or modify it + under the terms of the GNU Affero General Public License as published + by the Free Software Foundation, either version 3 of the License, + or (at your option) any later version. GNUnet is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - General Public License for more details. - - You should have received a copy of the GNU General Public License - along with GNUnet; see the file COPYING. If not, write to the - Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. + Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ /** * @file hostlist/gnunet-daemon-hostlist_client.c @@ -28,6 +26,7 @@ #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> @@ -142,14 +141,6 @@ struct Hostlist }; -struct HelloOffer -{ - struct HelloOffer *next; - struct HelloOffer *prev; - struct GNUNET_TRANSPORT_OfferHelloHandle *ohh; -}; - - /** * Our configuration. */ @@ -315,24 +306,10 @@ static unsigned int stat_hellos_obtained; */ 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; /** @@ -353,7 +330,6 @@ callback_download (void *ptr, 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; @@ -413,22 +389,10 @@ callback_download (void *ptr, ("# 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 { @@ -1567,6 +1531,7 @@ GNUNET_HOSTLIST_client_start (const struct GNUNET_CONFIGURATION_Handle *c, stats = st; /* Read proxy configuration */ + pi = GNUNET_PEERINFO_connect (c); if (GNUNET_OK == GNUNET_CONFIGURATION_get_value_string (cfg, "HOSTLIST", @@ -1723,18 +1688,8 @@ GNUNET_HOSTLIST_client_start (const struct GNUNET_CONFIGURATION_Handle *c, 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); @@ -1777,7 +1732,11 @@ GNUNET_HOSTLIST_client_stop () proxy_username = NULL; GNUNET_free_non_null (proxy_password); proxy_password = NULL; - + if (NULL != pi) + { + GNUNET_PEERINFO_disconnect (pi); + pi = NULL; + } cfg = NULL; } diff --git a/src/hostlist/gnunet-daemon-hostlist_client.h b/src/hostlist/gnunet-daemon-hostlist_client.h index e41b90876c..c7ee072a95 100644 --- a/src/hostlist/gnunet-daemon-hostlist_client.h +++ b/src/hostlist/gnunet-daemon-hostlist_client.h @@ -2,20 +2,18 @@ This file is part of GNUnet. Copyright (C) 2009 GNUnet e.V. - GNUnet is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published - by the Free Software Foundation; either version 3, or (at your - option) any later version. + GNUnet is free software: you can redistribute it and/or modify it + under the terms of the GNU Affero General Public License as published + by the Free Software Foundation, either version 3 of the License, + or (at your option) any later version. GNUnet is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - General Public License for more details. - - You should have received a copy of the GNU General Public License - along with GNUnet; see the file COPYING. If not, write to the - Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. + Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ /** * @file hostlist/gnunet-daemon-hostlist_client.h diff --git a/src/hostlist/gnunet-daemon-hostlist_server.c b/src/hostlist/gnunet-daemon-hostlist_server.c index 3df6f1ef86..8687d6e952 100644 --- a/src/hostlist/gnunet-daemon-hostlist_server.c +++ b/src/hostlist/gnunet-daemon-hostlist_server.c @@ -2,20 +2,18 @@ This file is part of GNUnet. Copyright (C) 2008, 2009, 2010, 2014, 2016 GNUnet e.V. - GNUnet is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published - by the Free Software Foundation; either version 3, or (at your - option) any later version. + GNUnet is free software: you can redistribute it and/or modify it + under the terms of the GNU Affero General Public License as published + by the Free Software Foundation, either version 3 of the License, + or (at your option) any later version. GNUnet is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - General Public License for more details. - - You should have received a copy of the GNU General Public License - along with GNUnet; see the file COPYING. If not, write to the - Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. + Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ /** diff --git a/src/hostlist/gnunet-daemon-hostlist_server.h b/src/hostlist/gnunet-daemon-hostlist_server.h index d9f778a4bc..d30c68131a 100644 --- a/src/hostlist/gnunet-daemon-hostlist_server.h +++ b/src/hostlist/gnunet-daemon-hostlist_server.h @@ -2,20 +2,18 @@ This file is part of GNUnet. Copyright (C) 2009 GNUnet e.V. - GNUnet is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published - by the Free Software Foundation; either version 3, or (at your - option) any later version. + GNUnet is free software: you can redistribute it and/or modify it + under the terms of the GNU Affero General Public License as published + by the Free Software Foundation, either version 3 of the License, + or (at your option) any later version. GNUnet is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - General Public License for more details. - - You should have received a copy of the GNU General Public License - along with GNUnet; see the file COPYING. If not, write to the - Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. + Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ /** diff --git a/src/hostlist/test_gnunet_daemon_hostlist.c b/src/hostlist/test_gnunet_daemon_hostlist.c index dcdabaf6be..c3292939fc 100644 --- a/src/hostlist/test_gnunet_daemon_hostlist.c +++ b/src/hostlist/test_gnunet_daemon_hostlist.c @@ -2,20 +2,18 @@ This file is part of GNUnet Copyright (C) 2009, 2016 GNUnet e.V. - GNUnet is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published - by the Free Software Foundation; either version 3, or (at your - option) any later version. + GNUnet is free software: you can redistribute it and/or modify it + under the terms of the GNU Affero General Public License as published + by the Free Software Foundation, either version 3 of the License, + or (at your option) any later version. GNUnet is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - General Public License for more details. - - You should have received a copy of the GNU General Public License - along with GNUnet; see the file COPYING. If not, write to the - Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. + Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ /** * @file hostlist/test_gnunet_daemon_hostlist.c diff --git a/src/hostlist/test_gnunet_daemon_hostlist_learning.c b/src/hostlist/test_gnunet_daemon_hostlist_learning.c index 799ffc3ffa..e420a50220 100644 --- a/src/hostlist/test_gnunet_daemon_hostlist_learning.c +++ b/src/hostlist/test_gnunet_daemon_hostlist_learning.c @@ -2,20 +2,18 @@ This file is part of GNUnet Copyright (C) 2009, 2010, 2011, 2012, 2016 GNUnet e.V. - GNUnet is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published - by the Free Software Foundation; either version 3, or (at your - option) any later version. + GNUnet is free software: you can redistribute it and/or modify it + under the terms of the GNU Affero General Public License as published + by the Free Software Foundation, either version 3 of the License, + or (at your option) any later version. GNUnet is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - General Public License for more details. - - You should have received a copy of the GNU General Public License - along with GNUnet; see the file COPYING. If not, write to the - Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. + Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ /** * @file hostlist/test_gnunet_daemon_hostlist_learning.c diff --git a/src/hostlist/test_gnunet_daemon_hostlist_reconnect.c b/src/hostlist/test_gnunet_daemon_hostlist_reconnect.c index 2ab55b6681..dad55f3d3f 100644 --- a/src/hostlist/test_gnunet_daemon_hostlist_reconnect.c +++ b/src/hostlist/test_gnunet_daemon_hostlist_reconnect.c @@ -2,20 +2,18 @@ This file is part of GNUnet Copyright (C) 2010, 2016 GNUnet e.V. - GNUnet is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published - by the Free Software Foundation; either version 3, or (at your - option) any later version. + GNUnet is free software: you can redistribute it and/or modify it + under the terms of the GNU Affero General Public License as published + by the Free Software Foundation, either version 3 of the License, + or (at your option) any later version. GNUnet is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - General Public License for more details. - - You should have received a copy of the GNU General Public License - along with GNUnet; see the file COPYING. If not, write to the - Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. + Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ /** * @file hostlist/test_gnunet_daemon_hostlist_reconnect.c |