re-align to master

This commit is contained in:
JackDoan
2026-07-14 11:38:43 -05:00
parent 68e3fae870
commit 7cc37323a8
6 changed files with 23 additions and 30 deletions
+7 -9
View File
@@ -70,21 +70,19 @@ type ControlHostInfo struct {
}
// Start actually runs nebula, this is a nonblocking call.
// The returned function blocks until nebula has fully stopped and reports the
// fatal reader error (nil on a clean shutdown). Calling it is equivalent to
// calling Wait.
func (c *Control) Start() (func() error, error) {
// Use Wait to block until nebula has fully stopped and to learn whether a fatal reader error caused the shutdown.
func (c *Control) Start() error {
c.stateLock.Lock()
defer c.stateLock.Unlock()
switch c.state {
case StateReady:
//yay!
case StateStopped, StateStopping:
return nil, ErrAlreadyStopped
return ErrAlreadyStopped
case StateStarted:
return nil, ErrAlreadyStarted
return ErrAlreadyStarted
default:
return nil, ErrUnknownState
return ErrUnknownState
}
// Activate the interface
@@ -94,7 +92,7 @@ func (c *Control) Start() (func() error, error) {
c.cancel()
_ = c.f.Close()
c.state = StateStopped
return nil, err
return err
}
// Call all the delayed funcs that waited patiently for the interface to be created.
@@ -122,7 +120,7 @@ func (c *Control) Start() (func() error, error) {
// Start reading packets.
c.f.run()
c.state = StateStarted
return c.Wait, nil
return nil
}
func (c *Control) State() RunState {