@ -619,18 +619,13 @@ func NewLocalBackend(logf logger.Logf, logID logid.PublicID, sys *tsd.System, lo
// [eventbus.Subscriber]'s and passes them to their related handler. Events are
// [eventbus.Subscriber]'s and passes them to their related handler. Events are
// always handled in the order they are received, i.e. the next event is not
// always handled in the order they are received, i.e. the next event is not
// read until the previous event's handler has returned. It returns when the
// read until the previous event's handler has returned. It returns when the
// [tailcfg.ClientVersion] subscriber is closed, which is interpreted to be the
// [eventbus.Client] is closed.
// same as the [eventbus.Client] closing ([eventbus.Subscribers] are either
// all open or all closed).
func ( b * LocalBackend ) consumeEventbusTopics ( ) {
func ( b * LocalBackend ) consumeEventbusTopics ( ) {
defer close ( b . subsDoneCh )
defer close ( b . subsDoneCh )
for {
for {
select {
select {
// TODO(cmol): Move to using b.eventClient.Done() once implemented.
case <- b . eventClient . Done ( ) :
// In the meantime, we rely on the subs not going away until the client is
// closed, closing all its subscribers.
case <- b . clientVersionSub . Done ( ) :
return
return
case clientVersion := <- b . clientVersionSub . Events ( ) :
case clientVersion := <- b . clientVersionSub . Events ( ) :
b . onClientVersion ( & clientVersion )
b . onClientVersion ( & clientVersion )