MCPcopy Create free account
hub / github.com/akash-network/node / newSubscriber

Function newSubscriber

pubsub/bus.go:180–202  ·  view source on GitHub ↗
(parent *bus)

Source from the content-addressed store, hash-verified

178}
179
180func newSubscriber(parent *bus) *bus {
181 // Re-use bus struct, but populate output channel (eventch)
182 // to enable subscriber mode.
183
184 evbuf := make([]Event, len(parent.evbuf))
185 copy(evbuf, parent.evbuf)
186
187 sub := &bus{
188 eventch: make(chan Event),
189 parentch: parent.unsubch,
190 evbuf: evbuf,
191
192 subscriptions: make(map[*bus]bool),
193 pubch: make(chan Event),
194 subch: make(chan chan<- Subscriber),
195 unsubch: make(chan *bus),
196 lc: lifecycle.New(),
197 }
198
199 go sub.run()
200
201 return sub
202}

Callers 1

runMethod · 0.85

Calls 1

runMethod · 0.95

Tested by

no test coverage detected