aboutsummaryrefslogtreecommitdiff
path: root/src/stream/test_stream_local.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/stream/test_stream_local.c')
-rw-r--r--src/stream/test_stream_local.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/src/stream/test_stream_local.c b/src/stream/test_stream_local.c
index 535ee62a2..c3fcc6492 100644
--- a/src/stream/test_stream_local.c
+++ b/src/stream/test_stream_local.c
@@ -101,6 +101,9 @@ static GNUNET_SCHEDULER_TaskIdentifier read_task;
101static char *data = "ABCD"; 101static char *data = "ABCD";
102static int result; 102static int result;
103 103
104static int writing_success;
105static int reading_success;
106
104 107
105/** 108/**
106 * Check whether peers successfully shut down. 109 * Check whether peers successfully shut down.
@@ -197,9 +200,8 @@ write_completion (void *cls,
197 enum GNUNET_STREAM_Status status, 200 enum GNUNET_STREAM_Status status,
198 size_t size) 201 size_t size)
199{ 202{
200 struct PeerData *peer; 203 struct PeerData *peer = cls;
201 204
202 peer = (struct PeerData *) cls;
203 GNUNET_assert (GNUNET_STREAM_OK == status); 205 GNUNET_assert (GNUNET_STREAM_OK == status);
204 GNUNET_assert (size <= strlen (data)); 206 GNUNET_assert (size <= strlen (data));
205 peer->bytes_wrote += size; 207 peer->bytes_wrote += size;
@@ -232,6 +234,12 @@ write_completion (void *cls,
232 cls); 234 cls);
233 GNUNET_assert (NULL!=peer->io_read_handle); 235 GNUNET_assert (NULL!=peer->io_read_handle);
234 } 236 }
237 else
238 {
239 writing_success = GNUNET_YES;
240 if (GNUNET_YES == reading_success)
241 GNUNET_SCHEDULER_add_now (&do_shutdown, NULL);
242 }
235 } 243 }
236} 244}
237 245
@@ -335,7 +343,9 @@ input_processor (void *cls,
335 } 343 }
336 else /* Peer1 has completed reading. End of tests */ 344 else /* Peer1 has completed reading. End of tests */
337 { 345 {
338 GNUNET_SCHEDULER_add_now (&do_shutdown, NULL); 346 reading_success = GNUNET_YES;
347 if (GNUNET_YES == writing_success)
348 GNUNET_SCHEDULER_add_now (&do_shutdown, NULL);
339 } 349 }
340 } 350 }
341 return size; 351 return size;