Browse Source

fix 'runOnDemandRestart: yes' (#1947)

pull/1965/head
Alessandro Ros 3 years ago committed by GitHub
parent
commit
d3354a0c99
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 19
      internal/core/path.go

19
internal/core/path.go

@ -606,19 +606,18 @@ func (pa *path) onDemandPublisherScheduleClose() {
} }
func (pa *path) onDemandPublisherStop() { func (pa *path) onDemandPublisherStop() {
if pa.source != nil {
pa.source.(publisher).close()
pa.doPublisherRemove()
}
if pa.onDemandPublisherState == pathOnDemandStateClosing { if pa.onDemandPublisherState == pathOnDemandStateClosing {
pa.onDemandPublisherCloseTimer.Stop() pa.onDemandPublisherCloseTimer.Stop()
pa.onDemandPublisherCloseTimer = newEmptyTimer() pa.onDemandPublisherCloseTimer = newEmptyTimer()
} }
// set state before doPublisherRemove()
pa.onDemandPublisherState = pathOnDemandStateInitial pa.onDemandPublisherState = pathOnDemandStateInitial
if pa.source != nil {
pa.source.(publisher).close()
pa.doPublisherRemove()
}
if pa.onDemandCmd != nil { if pa.onDemandCmd != nil {
pa.onDemandCmd.Close() pa.onDemandCmd.Close()
pa.onDemandCmd = nil pa.onDemandCmd = nil
@ -683,12 +682,8 @@ func (pa *path) doReaderRemove(r reader) {
func (pa *path) doPublisherRemove() { func (pa *path) doPublisherRemove() {
if pa.stream != nil { if pa.stream != nil {
if pa.conf.HasOnDemandPublisher() && pa.onDemandPublisherState != pathOnDemandStateInitial {
pa.onDemandPublisherStop()
} else {
pa.sourceSetNotReady() pa.sourceSetNotReady()
} }
}
pa.source = nil pa.source = nil
} }
@ -811,12 +806,8 @@ func (pa *path) handlePublisherStart(req pathPublisherStartReq) {
func (pa *path) handlePublisherStop(req pathPublisherStopReq) { func (pa *path) handlePublisherStop(req pathPublisherStopReq) {
if req.author == pa.source && pa.stream != nil { if req.author == pa.source && pa.stream != nil {
if pa.conf.HasOnDemandPublisher() && pa.onDemandPublisherState != pathOnDemandStateInitial {
pa.onDemandPublisherStop()
} else {
pa.sourceSetNotReady() pa.sourceSetNotReady()
} }
}
close(req.res) close(req.res)
} }

Loading…
Cancel
Save