This commit is contained in:
davidnewhall2 2020-06-15 02:20:48 -07:00
parent 150a37b302
commit cf49ad2f63
1 changed files with 3 additions and 4 deletions

View File

@ -22,14 +22,13 @@ func (u *InputUnifi) isNill(c *Controller) bool {
return c.Unifi == nil
}
// newDynamicCntrlr creates and saves a controller (with auth cookie) for repeated use.
// newDynamicCntrlr creates and saves a controller definition for further use.
// This is called when an unconfigured controller is requested.
func (u *InputUnifi) newDynamicCntrlr(url string) (bool, *Controller) {
u.Lock()
defer u.Unlock()
c := u.dynamic[url]
if c != nil {
if c := u.dynamic[url]; c != nil {
// it already exists.
return false, c
}
@ -39,7 +38,7 @@ func (u *InputUnifi) newDynamicCntrlr(url string) (bool, *Controller) {
u.dynamic[url].Role = url
u.dynamic[url].URL = url
return true, c
return true, u.dynamic[url]
}
func (u *InputUnifi) dynamicController(url string) (*poller.Metrics, error) {