aboutsummaryrefslogtreecommitdiff
path: root/src/topology
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2016-07-08 16:34:31 +0000
committerChristian Grothoff <christian@grothoff.org>2016-07-08 16:34:31 +0000
commit6e3599bab213760c66f13f6103ebf650bbe5b7e9 (patch)
treef56a0bbe3ce64c818c87bae6171ba800ab05b701 /src/topology
parent2c0a286c8c29e135c68556658b6ac6cef48a874a (diff)
downloadgnunet-6e3599bab213760c66f13f6103ebf650bbe5b7e9.tar.gz
gnunet-6e3599bab213760c66f13f6103ebf650bbe5b7e9.zip
migrate transport_core API to MQ
Diffstat (limited to 'src/topology')
-rw-r--r--src/topology/gnunet-daemon-topology.c55
1 files changed, 26 insertions, 29 deletions
diff --git a/src/topology/gnunet-daemon-topology.c b/src/topology/gnunet-daemon-topology.c
index eddac8c8a..9baaf513d 100644
--- a/src/topology/gnunet-daemon-topology.c
+++ b/src/topology/gnunet-daemon-topology.c
@@ -142,11 +142,6 @@ static const struct GNUNET_CONFIGURATION_Handle *cfg;
142static struct GNUNET_CORE_Handle *handle; 142static struct GNUNET_CORE_Handle *handle;
143 143
144/** 144/**
145 * Handle to the TRANSPORT service.
146 */
147static struct GNUNET_TRANSPORT_Handle *transport;
148
149/**
150 * Handle to the ATS service. 145 * Handle to the ATS service.
151 */ 146 */
152static struct GNUNET_ATS_ConnectivityHandle *ats; 147static struct GNUNET_ATS_ConnectivityHandle *ats;
@@ -180,6 +175,11 @@ static struct GNUNET_TRANSPORT_Blacklist *blacklist;
180static struct GNUNET_SCHEDULER_Task *add_task; 175static struct GNUNET_SCHEDULER_Task *add_task;
181 176
182/** 177/**
178 * Active HELLO offering to transport service.
179 */
180static struct GNUNET_TRANSPORT_OfferHelloHandle *oh;
181
182/**
183 * Flag to disallow non-friend connections (pure F2F mode). 183 * Flag to disallow non-friend connections (pure F2F mode).
184 */ 184 */
185static int friends_only; 185static int friends_only;
@@ -1008,6 +1008,16 @@ read_friends_file (const struct GNUNET_CONFIGURATION_Handle *cfg)
1008 1008
1009 1009
1010/** 1010/**
1011 * Hello offer complete. Clean up.
1012 */
1013static void
1014done_offer_hello (void *cls)
1015{
1016 oh = NULL;
1017}
1018
1019
1020/**
1011 * This function is called whenever an encrypted HELLO message is 1021 * This function is called whenever an encrypted HELLO message is
1012 * received. 1022 * received.
1013 * 1023 *
@@ -1055,11 +1065,12 @@ handle_encrypted_hello (void *cls,
1055 (friend_count < minimum_friend_count)) 1065 (friend_count < minimum_friend_count))
1056 return GNUNET_OK; 1066 return GNUNET_OK;
1057 } 1067 }
1058 if (NULL != transport) 1068 if (NULL != oh)
1059 GNUNET_TRANSPORT_offer_hello (transport, 1069 GNUNET_TRANSPORT_offer_hello_cancel (oh);
1060 message, 1070 oh = GNUNET_TRANSPORT_offer_hello (cfg,
1061 NULL, 1071 message,
1062 NULL); 1072 &done_offer_hello,
1073 NULL);
1063 return GNUNET_OK; 1074 return GNUNET_OK;
1064} 1075}
1065 1076
@@ -1136,11 +1147,6 @@ cleaning_task (void *cls)
1136 GNUNET_PEERINFO_notify_cancel (peerinfo_notify); 1147 GNUNET_PEERINFO_notify_cancel (peerinfo_notify);
1137 peerinfo_notify = NULL; 1148 peerinfo_notify = NULL;
1138 } 1149 }
1139 if (NULL != transport)
1140 {
1141 GNUNET_TRANSPORT_disconnect (transport);
1142 transport = NULL;
1143 }
1144 if (NULL != handle) 1150 if (NULL != handle)
1145 { 1151 {
1146 GNUNET_CORE_disconnect (handle); 1152 GNUNET_CORE_disconnect (handle);
@@ -1152,6 +1158,11 @@ cleaning_task (void *cls)
1152 GNUNET_SCHEDULER_cancel (add_task); 1158 GNUNET_SCHEDULER_cancel (add_task);
1153 add_task = NULL; 1159 add_task = NULL;
1154 } 1160 }
1161 if (NULL != oh)
1162 {
1163 GNUNET_TRANSPORT_offer_hello_cancel (oh);
1164 oh = NULL;
1165 }
1155 GNUNET_CONTAINER_multipeermap_iterate (peers, 1166 GNUNET_CONTAINER_multipeermap_iterate (peers,
1156 &free_peer, 1167 &free_peer,
1157 NULL); 1168 NULL);
@@ -1223,12 +1234,6 @@ run (void *cls,
1223 &blacklist_check, 1234 &blacklist_check,
1224 NULL); 1235 NULL);
1225 ats = GNUNET_ATS_connectivity_init (cfg); 1236 ats = GNUNET_ATS_connectivity_init (cfg);
1226 transport = GNUNET_TRANSPORT_connect (cfg,
1227 NULL,
1228 NULL,
1229 NULL,
1230 NULL,
1231 NULL);
1232 handle = 1237 handle =
1233 GNUNET_CORE_connect (cfg, NULL, 1238 GNUNET_CORE_connect (cfg, NULL,
1234 &core_init, 1239 &core_init,
@@ -1239,14 +1244,6 @@ run (void *cls,
1239 handlers); 1244 handlers);
1240 GNUNET_SCHEDULER_add_shutdown (&cleaning_task, 1245 GNUNET_SCHEDULER_add_shutdown (&cleaning_task,
1241 NULL); 1246 NULL);
1242 if (NULL == transport)
1243 {
1244 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
1245 _("Failed to connect to `%s' service.\n"),
1246 "transport");
1247 GNUNET_SCHEDULER_shutdown ();
1248 return;
1249 }
1250 if (NULL == handle) 1247 if (NULL == handle)
1251 { 1248 {
1252 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 1249 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,