Skip to content

Commit c06c363

Browse files
committed
Unsubscribe by attributes should only match a subset of subscriptions
1 parent 87cd2c0 commit c06c363

File tree

1 file changed

+48
-7
lines changed

1 file changed

+48
-7
lines changed

index.bs

Lines changed: 48 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2054,21 +2054,47 @@ The [=remote end steps=] with |session| and |command parameters| are:
20542054

20552055
1. Let |new subscriptions| to be a [=/list=].
20562056

2057+
1. Let |match| be false.
2058+
20572059
1. For each |subscription| of |session|'s [=subscriptions=]:
20582060

2061+
1. If |match| is true:
2062+
2063+
1. [=list/append=] |subscription| to |new subscriptions|.
2064+
2065+
1. [=Continue=].
2066+
20592067
1. If [=set/intersection=] of |subscription|'s [=subscription/event names=] and |event names| is an empty [=/set=]:
20602068

20612069
1. [=list/append=] |subscription| to |new subscriptions|.
20622070

2063-
1. Continue.
2071+
1. [=Continue=].
20642072

20652073
1. If |top-level traversable context ids| is an empty [=/set=]:
20662074

2067-
1. [=list/Remove=] all items [=list/contains|contained=] in |event names| from |subscription|'s [=subscription/event names=].
2075+
1. If |subscription|'s [=subscription/top-level traversable ids=] [=set/size=] is not zero:
20682076

2069-
1. If |subscription|'s [=subscription/event names=] is not empty:
2077+
1. [=list/append=] |subscription| to |new subscriptions|.
20702078

2071-
1. [=list/append=] |subscription| to |new subscriptions|.
2079+
1. [=Continue=].
2080+
2081+
1. Let |subscription event names| be [=set/clone=] of |subscription|'s [=subscription/event names=].
2082+
2083+
1. For each |event name| of |event names|:
2084+
2085+
1. If |subscription event names| [=set/contains=] |event name|:
2086+
2087+
1. [=list/Remove=] |event name| from |event names|.
2088+
2089+
1. [=list/Remove=] |event name| from |subscription event names|.
2090+
2091+
1. If |event names| [=set/size=] is zero, set |match| to true.
2092+
2093+
1. If |subscription event names| is not empty:
2094+
2095+
1. Set |subscription|'s [=subscription/event names=] to |subscription event names|.
2096+
2097+
1. [=list/append=] |subscription| to |new subscriptions|.
20722098

20732099
1. Otherwise:
20742100

@@ -2086,18 +2112,29 @@ The [=remote end steps=] with |session| and |command parameters| are:
20862112

20872113
1. Set |event map|[|event name|] to [=set/clone=] of |subscription|'s [=subscription/top-level traversable ids=].
20882114

2115+
1. Let |context ids to remove| be an empty [=/set=].
2116+
20892117
1. For each |event name| in |event names|:
20902118

20912119
1. If |event map|[|event name|] does not exist,
2092-
continue.
2120+
[=continue=].
2121+
2122+
1. For each |top-level traversable id| of |top-level traversable context ids|:
2123+
2124+
1. If |event map|[|event name|] [=set/contains=] |top-level traversable id|:
20932125

2094-
1. Set |event map|[|event name|] to the [=set/difference=]
2095-
between |event map|[|event name|] and |top-level traversable context ids|.
2126+
1. [=list/Append=] |top-level traversable id| to |context ids to remove|.
2127+
2128+
1. [=list/Remove=] |top-level traversable id| from |event map|[|event name|].
20962129

20972130
1. If |event map|[|event name|] is an empty [=/set=],
20982131

20992132
1. [=map/Remove=] |event map|[|event name|].
21002133

2134+
1. For each |top-level traversable id| of |context ids to remove|:
2135+
2136+
1. [=list/Remove=] |top-level traversable id| from |top-level traversable context ids|.
2137+
21012138
1. For each |event name| → |remaining top-level traversable ids| in |event map|:
21022139

21032140
1. Let |partial subscription| be a [=subscription=] with
@@ -2107,6 +2144,10 @@ The [=remote end steps=] with |session| and |command parameters| are:
21072144

21082145
1. [=list/append=] |partial subscription| to |new subscriptions|.
21092146

2147+
1. If |top-level traversable context ids| is empty, set |match| to true.
2148+
2149+
1. If |match| is false, return [=error=] with [=error code=] [=invalid argument=].
2150+
21102151
1. Set |session|'s [=subscriptions=] to |new subscriptions|.
21112152

21122153
1. Otherwise:

0 commit comments

Comments
 (0)