@ -145,7 +145,7 @@ type Auto struct {
closed bool
closed bool
updateCh chan struct { } // readable when we should inform the server of a change
updateCh chan struct { } // readable when we should inform the server of a change
newMapCh chan struct { } // readable when we must restart a map request
newMapCh chan struct { } // readable when we must restart a map request
statusFunc func ( Status ) // called to update Client status; always non-nil
observer Observer // called to update Client status; always non-nil
unregisterHealthWatch func ( )
unregisterHealthWatch func ( )
@ -194,8 +194,8 @@ func NewNoStart(opts Options) (_ *Auto, err error) {
}
}
} ( )
} ( )
if opts . Status == nil {
if opts . Observer == nil {
return nil , errors . New ( "missing required Options. Status ")
return nil , errors . New ( "missing required Options. Observer ")
}
}
if opts . Logf == nil {
if opts . Logf == nil {
opts . Logf = func ( fmt string , args ... any ) { }
opts . Logf = func ( fmt string , args ... any ) { }
@ -213,7 +213,7 @@ func NewNoStart(opts Options) (_ *Auto, err error) {
authDone : make ( chan struct { } ) ,
authDone : make ( chan struct { } ) ,
mapDone : make ( chan struct { } ) ,
mapDone : make ( chan struct { } ) ,
updateDone : make ( chan struct { } ) ,
updateDone : make ( chan struct { } ) ,
statusFunc: opts . Status ,
observer: opts . Observer ,
}
}
c . authCtx , c . authCancel = context . WithCancel ( context . Background ( ) )
c . authCtx , c . authCancel = context . WithCancel ( context . Background ( ) )
c . authCtx = sockstats . WithSockStats ( c . authCtx , sockstats . LabelControlClientAuto , opts . Logf )
c . authCtx = sockstats . WithSockStats ( c . authCtx , sockstats . LabelControlClientAuto , opts . Logf )
@ -669,7 +669,7 @@ func (c *Auto) sendStatus(who string, err error, url string, nm *netmap.NetworkM
State : state ,
State : state ,
Err : err ,
Err : err ,
}
}
c . statusFunc ( new )
c . observer . SetControlClientStatus ( new )
c . mu . Lock ( )
c . mu . Lock ( )
c . inSendStatus --
c . inSendStatus --