SetOutputChannel plugs an outgoing mock channel into the manager. Only resets outChanClosed when the channel pointer changes — re-setting the same pointer after CloseOutChan must NOT reopen the closed flag, otherwise a subsequent send would hit a post-close channel and panic. The proxy calls this on
(out chan<- *models.Mock)
| 252 | // A distinct channel pointer means a new session (re-record), and |
| 253 | // only then do we clear the closed flag. |
| 254 | func (m *SyncMockManager) SetOutputChannel(out chan<- *models.Mock) { |
| 255 | m.outChanMu.Lock() |
| 256 | defer m.outChanMu.Unlock() |
| 257 | if out != m.outChan { |
| 258 | m.outChan = out |
| 259 | m.outChanClosed = false |
| 260 | } |
| 261 | } |
| 262 | |
| 263 | func (m *SyncMockManager) SetMappingChannel(ch chan<- models.TestMockMapping) { |
| 264 | m.mu.Lock() |
no outgoing calls