Commit Graph

7 Commits

Author SHA1 Message Date
Boqin Qin
1821328162
event: add missing unlock before panic (#20653) 2020-02-12 10:33:31 +01:00
Felix Lange
7f70a70106 event: remove unused field 'closed' (#20324) 2019-11-19 16:00:32 +02:00
Felix Lange
53a18d2e27 event: document select case slice use and add edge case test (#16680)
Feed keeps active subscription channels in a slice called 'f.sendCases'.
The Send method tracks the active cases in a local variable 'cases'
whose value is f.sendCases initially. 'cases' shrinks to a shorter
prefix of f.sendCases every time a send succeeds, moving the successful
case out of range of the active case list.

This can be confusing because the two slices share a backing array. Add
more comments to document what is going on. Also add a test for removing
a case that is in 'f.sentCases' but not 'cases'.
2018-05-10 13:26:36 +03:00
Péter Szilágyi
65738c1eb3
event: fix datarace between Subscribe and Send 2017-10-20 14:42:19 +03:00
Péter Szilágyi
9b5c7153c9
event: use sync.Once for init for faster/cleaner locking 2017-02-03 14:04:57 +02:00
Felix Lange
1bed9b3fea
event: address review issues (multiple commits)
event: address Feed review issues

event: clarify role of NewSubscription function

event: more Feed review fixes

* take sendLock after dropping f.mu
* add constant for number of special cases

event: fix subscribing/unsubscribing while Send is blocked
2017-02-03 13:37:49 +02:00
Felix Lange
6d5e100d0d event: add new Subscription type and related utilities
This commit introduces a new Subscription type, which is synonymous with
ethereum.Subscription. It also adds a couple of utilities that make
working with Subscriptions easier. The mot complex utility is Feed, a
synchronisation device that implements broadcast subscriptions. Feed is
slightly faster than TypeMux and will replace uses of TypeMux across the
go-ethereum codebase in the future.
2017-01-25 18:44:20 +01:00