@@ -91,7 +91,6 @@ type path struct {
9191 pendingRequests * int64
9292 confMutex sync.RWMutex
9393 source defs.Source
94- publisherQuery string
9594 stream * stream.Stream
9695 recorder * recorder.Recorder
9796 availableTime time.Time
@@ -182,7 +181,7 @@ func (pa *path) run() {
182181 defer pa .wg .Done ()
183182
184183 if pa .conf .AlwaysAvailable {
185- err := pa .setAvailable (nil , true )
184+ err := pa .setAvailable (nil , "" , nil , true )
186185 if err != nil {
187186 panic (err )
188187 }
@@ -416,7 +415,7 @@ func (pa *path) doReloadConf(newConf *conf.Path) {
416415
417416func (pa * path ) doSourceStaticSetReady (req defs.PathSourceStaticSetReadyReq ) {
418417 if ! pa .conf .AlwaysAvailable {
419- err := pa .setAvailable (req .Desc , req .ReplaceNTP )
418+ err := pa .setAvailable (pa . source , "" , req .Desc , req .ReplaceNTP )
420419 if err != nil {
421420 req .Res <- defs.PathSourceStaticSetReadyRes {Err : err }
422421 return
@@ -535,16 +534,9 @@ func (pa *path) doAddPublisher(req defs.PathAddPublisherReq) {
535534 pa .executeRemovePublisher ()
536535 }
537536
538- pa .source = req .Author
539- pa .publisherQuery = req .AccessRequest .Query
540-
541- req .Author .Log (logger .Info , "is publishing to path '%s'" ,
542- pa .name )
543-
544537 if ! pa .conf .AlwaysAvailable {
545- err := pa .setAvailable (req .Desc , req .ReplaceNTP )
538+ err := pa .setAvailable (req .Author , req . AccessRequest . Query , req . Desc , req .ReplaceNTP )
546539 if err != nil {
547- pa .source = nil
548540 req .Res <- defs.PathAddPublisherRes {Err : err }
549541 return
550542 }
@@ -563,6 +555,11 @@ func (pa *path) doAddPublisher(req defs.PathAddPublisherReq) {
563555 return
564556 }
565557
558+ pa .source = req .Author
559+
560+ req .Author .Log (logger .Info , "is publishing to path '%s'" ,
561+ pa .name )
562+
566563 if pa .conf .AlwaysAvailable {
567564 pa .onlineTime = time .Now ()
568565 }
@@ -784,7 +781,12 @@ func (pa *path) onDemandPublisherStop(reason string) {
784781 pa .onDemandPublisherState = pathOnDemandStateInitial
785782}
786783
787- func (pa * path ) setAvailable (desc * description.Session , replaceNTP bool ) error {
784+ func (pa * path ) setAvailable (
785+ source defs.Source ,
786+ publisherQuery string ,
787+ desc * description.Session ,
788+ replaceNTP bool ,
789+ ) error {
788790 pa .stream = & stream.Stream {
789791 Desc : desc ,
790792 AlwaysAvailable : pa .conf .AlwaysAvailable ,
@@ -811,8 +813,8 @@ func (pa *path) setAvailable(desc *description.Session, replaceNTP bool) error {
811813 }
812814
813815 var sourceDesc * defs.APIPathSource
814- if pa . source != nil {
815- sourceDesc = pa . source .APISourceDescribe ()
816+ if source != nil {
817+ sourceDesc = source .APISourceDescribe ()
816818 }
817819
818820 pa .onNotReadyHook = hooks .OnReady (hooks.OnReadyParams {
@@ -821,7 +823,7 @@ func (pa *path) setAvailable(desc *description.Session, replaceNTP bool) error {
821823 Conf : pa .conf ,
822824 ExternalCmdEnv : pa .ExternalCmdEnv (),
823825 Desc : sourceDesc ,
824- Query : pa . publisherQuery ,
826+ Query : publisherQuery ,
825827 })
826828
827829 if pa .conf .AlwaysAvailable {
0 commit comments