1.1 --- a/libfsclient/lib/src/notifier.cc Tue Jul 06 01:01:53 2021 +0200
1.2 +++ b/libfsclient/lib/src/notifier.cc Tue Jul 06 01:22:47 2021 +0200
1.3 @@ -102,7 +102,7 @@
1.4
1.5 /* Record the flags for the file object. */
1.6
1.7 - _affected_flags[file] |= flags;
1.8 + _affected_flags[file] = _affected_flags[file] | flags;
1.9 _affected.push_back(file);
1.10
1.11 /* Notify any waiting caller. */
1.12 @@ -130,14 +130,20 @@
1.13 if (l4_ipc_error(msg.tag, l4_utcb()))
1.14 continue;
1.15
1.16 + /* Interpret gate labels as file objects. */
1.17 +
1.18 + file_t *file = (file_t *) label;
1.19 +
1.20 + /* Obtain message details. */
1.21 +
1.22 + ipc_message_open(&msg);
1.23 +
1.24 + notify_flags_t flags = ipc_message_get_word(&msg, 0);
1.25 +
1.26 /* Reply to notifications. */
1.27
1.28 ipc_message_reply(&msg);
1.29 -
1.30 - /* Interpret gate labels as file objects. */
1.31 -
1.32 - file_t *file = (file_t *) label;
1.33 - notify_flags_t flags = ipc_message_get_word(&msg, 0);
1.34 + ipc_message_discard(&msg);
1.35
1.36 /* Register the notification. */
1.37
2.1 --- a/tests/dstest_pipe_client.cc Tue Jul 06 01:01:53 2021 +0200
2.2 +++ b/tests/dstest_pipe_client.cc Tue Jul 06 01:22:47 2021 +0200
2.3 @@ -81,8 +81,7 @@
2.4 static void read_pipes(file_t *reader1, file_t *reader2)
2.5 {
2.6 offset_t size = 600, totals[] = {0, 0};
2.7 - bool active[] = {true, true};
2.8 - int num_active = 2;
2.9 + unsigned int active = 2;
2.10 long err;
2.11 file_t *reader;
2.12
2.13 @@ -118,23 +117,19 @@
2.14 continue;
2.15 }
2.16
2.17 - nread = client_read(reader, buffer, size);
2.18 -
2.19 - // NOTE: Should really be testing for the condition somehow.
2.20 -
2.21 int p = reader == reader1 ? 0 : 1;
2.22
2.23 - if (!nread)
2.24 + printf("Pipe #%d notified with conditions:%s%s\n", p, reader->notifications & NOTIFY_PEER_CLOSED ? " closed" : "",
2.25 + reader->notifications & NOTIFY_CONTENT_AVAILABLE ? " content" : "");
2.26 +
2.27 + if (reader->notifications & NOTIFY_PEER_CLOSED)
2.28 {
2.29 - if (active[p])
2.30 - {
2.31 - active[p] = false;
2.32 - num_active--;
2.33 + active--;
2.34 + if (!active)
2.35 + break;
2.36 + }
2.37
2.38 - if (!num_active)
2.39 - break;
2.40 - }
2.41 - }
2.42 + nread = client_read(reader, buffer, size);
2.43
2.44 while (nread)
2.45 {