1.1 --- a/libfsserver/lib/pipes/pipe_pager.cc Sun Feb 26 18:43:52 2023 +0100
1.2 +++ b/libfsserver/lib/pipes/pipe_pager.cc Sun Feb 26 22:19:31 2023 +0100
1.3 @@ -64,7 +64,7 @@
1.4
1.5 _paging->notify_others(_writing ? PipePaging::WRITER : PipePaging::READER,
1.6 NOTIFY_PEER_CLOSED, NOTIFY_VALUES_NULL);
1.7 - unsubscribe();
1.8 + unsubscribe(_notifier);
1.9
1.10 /* Deallocate the paging coordinator if no other endpoints are active. */
1.11
1.12 @@ -178,12 +178,17 @@
1.13
1.14
1.15
1.16 -/* Subscribe to notifications. */
1.17 +/* Subscribe to notifications.
1.18 + Readers can subscribe to new data (at end), and pipe closed events.
1.19 + Writers can subscribe to new space and pipe closed events. */
1.20
1.21 long PipePager::subscribe(l4_cap_idx_t notifier, notify_flags_t flags)
1.22 {
1.23 - /* Readers can subscribe to new data (at end), and pipe closed events.
1.24 - Writers can subscribe to new space and pipe closed events. */
1.25 + /* A single notifier is recorded so that it may be unsubscribed when the
1.26 + file is closed. */
1.27 +
1.28 + if ((notifier != _notifier) && l4_is_valid_cap(_notifier))
1.29 + unsubscribe(_notifier);
1.30
1.31 _notifier = notifier;
1.32
1.33 @@ -193,10 +198,9 @@
1.34
1.35 /* Unsubscribe from notifications. */
1.36
1.37 -long PipePager::unsubscribe()
1.38 +long PipePager::unsubscribe(l4_cap_idx_t notifier)
1.39 {
1.40 - _paging->unsubscribe(_notifier);
1.41 - return L4_EOK;
1.42 + return _paging->unsubscribe(notifier);
1.43 }
1.44
1.45 // vim: tabstop=4 expandtab shiftwidth=4