aboutsummaryrefslogtreecommitdiff
path: root/src/topology/gnunet-daemon-topology.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/topology/gnunet-daemon-topology.c')
-rw-r--r--src/topology/gnunet-daemon-topology.c49
1 files changed, 23 insertions, 26 deletions
diff --git a/src/topology/gnunet-daemon-topology.c b/src/topology/gnunet-daemon-topology.c
index 4415d0a24..829fb5352 100644
--- a/src/topology/gnunet-daemon-topology.c
+++ b/src/topology/gnunet-daemon-topology.c
@@ -2,20 +2,18 @@
2 This file is part of GNUnet. 2 This file is part of GNUnet.
3 Copyright (C) 2007-2016 GNUnet e.V. 3 Copyright (C) 2007-2016 GNUnet e.V.
4 4
5 GNUnet is free software; you can redistribute it and/or modify 5 GNUnet is free software: you can redistribute it and/or modify it
6 it under the terms of the GNU General Public License as published 6 under the terms of the GNU Affero General Public License as published
7 by the Free Software Foundation; either version 3, or (at your 7 by the Free Software Foundation, either version 3 of the License,
8 option) any later version. 8 or (at your option) any later version.
9 9
10 GNUnet is distributed in the hope that it will be useful, but 10 GNUnet is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of 11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 General Public License for more details. 13 Affero General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU Affero General Public License
16 along with GNUnet; see the file COPYING. If not, write to the 16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 Boston, MA 02110-1301, USA.
19*/ 17*/
20 18
21/** 19/**
@@ -137,6 +135,11 @@ static const struct GNUNET_CONFIGURATION_Handle *cfg;
137static struct GNUNET_CORE_Handle *handle; 135static struct GNUNET_CORE_Handle *handle;
138 136
139/** 137/**
138 * Handle to the PEERINFO service.
139 */
140static struct GNUNET_PEERINFO_Handle *pi;
141
142/**
140 * Handle to the ATS service. 143 * Handle to the ATS service.
141 */ 144 */
142static struct GNUNET_ATS_ConnectivityHandle *ats; 145static struct GNUNET_ATS_ConnectivityHandle *ats;
@@ -999,16 +1002,6 @@ read_friends_file (const struct GNUNET_CONFIGURATION_Handle *cfg)
999 1002
1000 1003
1001/** 1004/**
1002 * Hello offer complete. Clean up.
1003 */
1004static void
1005done_offer_hello (void *cls)
1006{
1007 oh = NULL;
1008}
1009
1010
1011/**
1012 * This function is called whenever an encrypted HELLO message is 1005 * This function is called whenever an encrypted HELLO message is
1013 * received. 1006 * received.
1014 * 1007 *
@@ -1076,12 +1069,10 @@ handle_hello (void *cls,
1076 (friend_count < minimum_friend_count)) 1069 (friend_count < minimum_friend_count))
1077 return; 1070 return;
1078 } 1071 }
1079 if (NULL != oh) 1072 (void) GNUNET_PEERINFO_add_peer (pi,
1080 GNUNET_TRANSPORT_offer_hello_cancel (oh); 1073 message,
1081 oh = GNUNET_TRANSPORT_offer_hello (cfg, 1074 NULL,
1082 &message->header, 1075 NULL);
1083 &done_offer_hello,
1084 NULL);
1085} 1076}
1086 1077
1087 1078
@@ -1125,6 +1116,11 @@ cleaning_task (void *cls)
1125 GNUNET_ATS_connectivity_done (ats); 1116 GNUNET_ATS_connectivity_done (ats);
1126 ats = NULL; 1117 ats = NULL;
1127 } 1118 }
1119 if (NULL != pi)
1120 {
1121 GNUNET_PEERINFO_disconnect (pi);
1122 pi = NULL;
1123 }
1128 if (NULL != stats) 1124 if (NULL != stats)
1129 { 1125 {
1130 GNUNET_STATISTICS_destroy (stats, GNUNET_NO); 1126 GNUNET_STATISTICS_destroy (stats, GNUNET_NO);
@@ -1189,6 +1185,7 @@ run (void *cls,
1189 &blacklist_check, 1185 &blacklist_check,
1190 NULL); 1186 NULL);
1191 ats = GNUNET_ATS_connectivity_init (cfg); 1187 ats = GNUNET_ATS_connectivity_init (cfg);
1188 pi = GNUNET_PEERINFO_connect (cfg);
1192 handle = GNUNET_CORE_connect (cfg, 1189 handle = GNUNET_CORE_connect (cfg,
1193 NULL, 1190 NULL,
1194 &core_init, 1191 &core_init,