Skip to content
Snippets Groups Projects
Commit 0fa85a86 authored by Benjamin Wenger's avatar Benjamin Wenger
Browse files

made stop and start network follower return well formed errors when called...

made stop and start network follower return well formed errors when called while the follower is not in the correct status.
parent 0275ae84
Branches
Tags
1 merge request!23Release
...@@ -392,6 +392,11 @@ func (c *Client) StartNetworkFollower(timeout time.Duration) (<-chan interfaces. ...@@ -392,6 +392,11 @@ func (c *Client) StartNetworkFollower(timeout time.Duration) (<-chan interfaces.
jww.INFO.Printf("StartNetworkFollower() \n\tTransmisstionID: %s "+ jww.INFO.Printf("StartNetworkFollower() \n\tTransmisstionID: %s "+
"\n\tReceptionID: %s", u.TransmissionID, u.ReceptionID) "\n\tReceptionID: %s", u.TransmissionID, u.ReceptionID)
if c.status.get() != Stopping{
return nil, errors.Errorf("Cannot Start the Network Follower when it is not stopped")
}
c.clientErrorChannel = make(chan interfaces.ClientError, 1000) c.clientErrorChannel = make(chan interfaces.ClientError, 1000)
cer := func(source, message, trace string) { cer := func(source, message, trace string) {
...@@ -450,6 +455,11 @@ func (c *Client) StartNetworkFollower(timeout time.Duration) (<-chan interfaces. ...@@ -450,6 +455,11 @@ func (c *Client) StartNetworkFollower(timeout time.Duration) (<-chan interfaces.
func (c *Client) StopNetworkFollower() error { func (c *Client) StopNetworkFollower() error {
c.followerLock.Lock() c.followerLock.Lock()
defer c.followerLock.Unlock() defer c.followerLock.Unlock()
if c.status.get() != Running{
return errors.Errorf("Cannot Stop the Network Follower when it is not running")
}
err := c.status.toStopping() err := c.status.toStopping()
if err != nil { if err != nil {
return errors.WithMessage(err, "Failed to Stop the Network Follower") return errors.WithMessage(err, "Failed to Stop the Network Follower")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment