aboutsummaryrefslogtreecommitdiff
path: root/src/core/test_core_api.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2015-10-29 14:27:37 +0000
committerChristian Grothoff <christian@grothoff.org>2015-10-29 14:27:37 +0000
commit9baa7c3f6e6b7f1a29e3004147b9c70dddd33c74 (patch)
treeca1237b138edb085fa91ca34cf8069b86fe6a64c /src/core/test_core_api.c
parent8459c76076092899a74aa7e4451ed24faf91684b (diff)
downloadgnunet-9baa7c3f6e6b7f1a29e3004147b9c70dddd33c74.tar.gz
gnunet-9baa7c3f6e6b7f1a29e3004147b9c70dddd33c74.zip
replacing deprecated transport_try_connect call with ATS call
Diffstat (limited to 'src/core/test_core_api.c')
-rw-r--r--src/core/test_core_api.c41
1 files changed, 3 insertions, 38 deletions
diff --git a/src/core/test_core_api.c b/src/core/test_core_api.c
index b1c6c8212..9404aa0e6 100644
--- a/src/core/test_core_api.c
+++ b/src/core/test_core_api.c
@@ -50,8 +50,6 @@ static struct PeerContext p2;
50 50
51static struct GNUNET_SCHEDULER_Task *err_task; 51static struct GNUNET_SCHEDULER_Task *err_task;
52 52
53static struct GNUNET_SCHEDULER_Task *con_task;
54
55static int ok; 53static int ok;
56 54
57#define OKPP do { ok++; GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Now at stage %u at %s:%u\n", ok, __FILE__, __LINE__); } while (0) 55#define OKPP do { ok++; GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Now at stage %u at %s:%u\n", ok, __FILE__, __LINE__); } while (0)
@@ -107,11 +105,6 @@ terminate_task (void *cls,
107 GNUNET_assert (ok == 6); 105 GNUNET_assert (ok == 6);
108 terminate_peer (&p1); 106 terminate_peer (&p1);
109 terminate_peer (&p2); 107 terminate_peer (&p2);
110 if (NULL != con_task)
111 {
112 GNUNET_SCHEDULER_cancel (con_task);
113 con_task = NULL;
114 }
115 ok = 0; 108 ok = 0;
116} 109}
117 110
@@ -126,11 +119,6 @@ terminate_task_error (void *cls,
126 GNUNET_break (0); 119 GNUNET_break (0);
127 terminate_peer (&p1); 120 terminate_peer (&p1);
128 terminate_peer (&p2); 121 terminate_peer (&p2);
129 if (NULL != con_task)
130 {
131 GNUNET_SCHEDULER_cancel (con_task);
132 con_task = NULL;
133 }
134 ok = 42; 122 ok = 42;
135} 123}
136 124
@@ -164,11 +152,6 @@ connect_notify (void *cls,
164 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 152 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
165 "Encrypted connection established to peer `%4s'\n", 153 "Encrypted connection established to peer `%4s'\n",
166 GNUNET_i2s (peer)); 154 GNUNET_i2s (peer));
167 if (NULL != con_task)
168 {
169 GNUNET_SCHEDULER_cancel (con_task);
170 con_task = NULL;
171 }
172 pc->connect_status = 1; 155 pc->connect_status = 1;
173 if (pc == &p1) 156 if (pc == &p1)
174 { 157 {
@@ -249,26 +232,6 @@ static struct GNUNET_CORE_MessageHandler handlers[] = {
249 232
250 233
251static void 234static void
252connect_task (void *cls,
253 const struct GNUNET_SCHEDULER_TaskContext *tc)
254{
255 if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN))
256 {
257 con_task = NULL;
258 return;
259 }
260 con_task =
261 GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_SECONDS,
262 &connect_task,
263 NULL);
264 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
265 "Asking transport (1) to connect to peer `%4s'\n",
266 GNUNET_i2s (&p2.id));
267 GNUNET_TRANSPORT_try_connect (p1.th, &p2.id, NULL, NULL); /*FIXME TRY_CONNECT change */
268}
269
270
271static void
272init_notify (void *cls, 235init_notify (void *cls,
273 const struct GNUNET_PeerIdentity *my_identity) 236 const struct GNUNET_PeerIdentity *my_identity)
274{ 237{
@@ -293,7 +256,9 @@ init_notify (void *cls,
293 GNUNET_assert (ok == 3); 256 GNUNET_assert (ok == 3);
294 OKPP; 257 OKPP;
295 GNUNET_assert (cls == &p2); 258 GNUNET_assert (cls == &p2);
296 con_task = GNUNET_SCHEDULER_add_now (&connect_task, NULL); 259 p1.ats_sh = GNUNET_ATS_connectivity_suggest (p1.ats,
260 &p2.id,
261 1);
297 } 262 }
298} 263}
299 264