aboutsummaryrefslogtreecommitdiffstats
path: root/event/feed_test.go
Commit message (Collapse)AuthorAgeFilesLines
* event: document select case slice use and add edge case test (#16680)Felix Lange2018-05-101-0/+39
| | | | | | | | | | | 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'.
* event: address review issues (multiple commits)Felix Lange2017-02-031-0/+68
| | | | | | | | | | | | | 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
* event: add new Subscription type and related utilitiesFelix Lange2017-01-261-0/+226
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.