diff --git a/cmd/vidforward/file.go b/cmd/vidforward/file.go index 39ab39b1..f026da09 100644 --- a/cmd/vidforward/file.go +++ b/cmd/vidforward/file.go @@ -51,8 +51,7 @@ type BroadcastBasic struct { // ManagerBasic is a crude version of the BroadcastManager struct use to simplify // marshal/unmarshal overriding. type ManagerBasic struct { - Broadcasts map[MAC]*Broadcast - SlateExitSignals []MAC + Broadcasts map[MAC]*Broadcast } // MarshalJSON calls the default marshalling behaviour for the BroadcastBasic @@ -94,14 +93,7 @@ func (b *Broadcast) UnmarshalJSON(data []byte) error { // MarshalJSON calls the default marshaller for a ManagerBasic value using data // from a broadcastManager value. func (m *broadcastManager) MarshalJSON() ([]byte, error) { - var signals []MAC - for k := range m.slateExitSignals { - signals = append(signals, k) - } - return json.Marshal(ManagerBasic{ - Broadcasts: m.broadcasts, - SlateExitSignals: signals, - }) + return json.Marshal(ManagerBasic{Broadcasts: m.broadcasts}) } // UnmarshalJSON populates a ManagerBasic value from the provided data and then @@ -123,20 +115,23 @@ func (m *broadcastManager) UnmarshalJSON(data []byte) error { } m.dogNotifier = notifier - for _, mac := range mb.SlateExitSignals { - sigCh := make(chan struct{}) - m.slateExitSignals[mac] = sigCh - rv := m.getPipeline(mac) - if rv == nil { - panic("no pipeline for MAC") - } - if !inTest { - err := writeSlateAndCheckErrors(rv, sigCh, m.log) - if err != nil { - return fmt.Errorf("couldn't write slate for MAC %v: %w", mac, err) + for mac, b := range m.broadcasts { + if b.status == statusSlate { + sigCh := make(chan struct{}) + m.slateExitSignals[mac] = sigCh + rv := m.getPipeline(mac) + if rv == nil { + panic("no pipeline for MAC") + } + if !inTest { + err := writeSlateAndCheckErrors(rv, sigCh, m.log) + if err != nil { + return fmt.Errorf("couldn't write slate for MAC %v: %w", mac, err) + } } } } + return nil }