aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/transport/test_transport_api_blacklisting.c63
1 files changed, 9 insertions, 54 deletions
diff --git a/src/transport/test_transport_api_blacklisting.c b/src/transport/test_transport_api_blacklisting.c
index 72f8a71a3..a2add5957 100644
--- a/src/transport/test_transport_api_blacklisting.c
+++ b/src/transport/test_transport_api_blacklisting.c
@@ -117,42 +117,9 @@ notify_receive (void *cls,
117{ 117{
118 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 118 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
119 "Unexpectedly even received the message despite blacklist\n"); 119 "Unexpectedly even received the message despite blacklist\n");
120 GNUNET_SCHEDULER_shutdown (); 120 connected = GNUNET_YES;
121} 121 GNUNET_SCHEDULER_cancel (shutdown_task);
122 122 end (NULL);
123
124static size_t
125notify_ready (void *cls,
126 size_t size,
127 void *buf)
128{
129 struct GNUNET_MessageHeader *hdr;
130
131 th = NULL;
132 if (NULL == buf)
133 {
134 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
135 "Timeout occurred while waiting for transmit_ready\n");
136 GNUNET_SCHEDULER_shutdown ();
137 return 0;
138 }
139 GNUNET_assert (size >= TEST_MESSAGE_SIZE);
140 hdr = buf;
141 hdr->size = htons (TEST_MESSAGE_SIZE);
142 hdr->type = htons (TEST_MESSAGE_TYPE);
143 return TEST_MESSAGE_SIZE;
144}
145
146
147static void
148sendtask (void *cls)
149{
150 th = GNUNET_TRANSPORT_notify_transmit_ready (ccc->p[1]->th,
151 &ccc->p[0]->id,
152 TEST_MESSAGE_SIZE,
153 TIMEOUT,
154 &notify_ready,
155 ccc->p[0]);
156} 123}
157 124
158 125
@@ -172,22 +139,6 @@ notify_connect (void *cls,
172} 139}
173 140
174 141
175static void
176notify_disconnect (void *cls,
177 struct GNUNET_TRANSPORT_TESTING_PeerContext *me,
178 const struct GNUNET_PeerIdentity *other)
179{
180 GNUNET_TRANSPORT_TESTING_log_disconnect (cls,
181 me,
182 other);
183 if (NULL != th)
184 {
185 GNUNET_TRANSPORT_notify_transmit_ready_cancel (th);
186 th = NULL;
187 }
188}
189
190
191static int 142static int
192blacklist_cb (void *cls, 143blacklist_cb (void *cls,
193 const struct GNUNET_PeerIdentity *pid) 144 const struct GNUNET_PeerIdentity *pid)
@@ -244,13 +195,17 @@ int
244main (int argc, 195main (int argc,
245 char *argv[]) 196 char *argv[])
246{ 197{
198 struct GNUNET_TRANSPORT_TESTING_SendClosure sc = {
199 .num_messages = 1
200 };
247 struct GNUNET_TRANSPORT_TESTING_ConnectCheckContext my_ccc = { 201 struct GNUNET_TRANSPORT_TESTING_ConnectCheckContext my_ccc = {
248 .pre_connect_task = &start_blacklist, 202 .pre_connect_task = &start_blacklist,
249 .connect_continuation = &sendtask, 203 .connect_continuation = &GNUNET_TRANSPORT_TESTING_simple_send,
204 .connect_continuation_cls = &sc,
250 .config_file = "test_transport_api_data.conf", 205 .config_file = "test_transport_api_data.conf",
251 .rec = &notify_receive, 206 .rec = &notify_receive,
252 .nc = &notify_connect, 207 .nc = &notify_connect,
253 .nd = &notify_disconnect, 208 .nd = &GNUNET_TRANSPORT_TESTING_log_disconnect,
254 .shutdown_task = &custom_shutdown, 209 .shutdown_task = &custom_shutdown,
255 .timeout = TIMEOUT, 210 .timeout = TIMEOUT,
256 .bi_directional = GNUNET_YES 211 .bi_directional = GNUNET_YES