1.1 --- a/tests/dstest_pipe_client.cc Tue Jul 06 01:01:53 2021 +0200
1.2 +++ b/tests/dstest_pipe_client.cc Tue Jul 06 01:22:47 2021 +0200
1.3 @@ -81,8 +81,7 @@
1.4 static void read_pipes(file_t *reader1, file_t *reader2)
1.5 {
1.6 offset_t size = 600, totals[] = {0, 0};
1.7 - bool active[] = {true, true};
1.8 - int num_active = 2;
1.9 + unsigned int active = 2;
1.10 long err;
1.11 file_t *reader;
1.12
1.13 @@ -118,23 +117,19 @@
1.14 continue;
1.15 }
1.16
1.17 - nread = client_read(reader, buffer, size);
1.18 -
1.19 - // NOTE: Should really be testing for the condition somehow.
1.20 -
1.21 int p = reader == reader1 ? 0 : 1;
1.22
1.23 - if (!nread)
1.24 + printf("Pipe #%d notified with conditions:%s%s\n", p, reader->notifications & NOTIFY_PEER_CLOSED ? " closed" : "",
1.25 + reader->notifications & NOTIFY_CONTENT_AVAILABLE ? " content" : "");
1.26 +
1.27 + if (reader->notifications & NOTIFY_PEER_CLOSED)
1.28 {
1.29 - if (active[p])
1.30 - {
1.31 - active[p] = false;
1.32 - num_active--;
1.33 + active--;
1.34 + if (!active)
1.35 + break;
1.36 + }
1.37
1.38 - if (!num_active)
1.39 - break;
1.40 - }
1.41 - }
1.42 + nread = client_read(reader, buffer, size);
1.43
1.44 while (nread)
1.45 {