summaryrefslogtreecommitdiff
path: root/client/client.go
diff options
context:
space:
mode:
Diffstat (limited to 'client/client.go')
-rw-r--r--client/client.go7
1 files changed, 4 insertions, 3 deletions
diff --git a/client/client.go b/client/client.go
index bd002f1..482f66f 100644
--- a/client/client.go
+++ b/client/client.go
@@ -42,8 +42,8 @@ func (c *Client) Start() (bool, error) {
c.mu.Lock()
defer c.mu.Unlock()
- if c.server != nil {
- log.Printf("Cannot start proxy server if already initialized")
+ if c.started {
+ log.Printf("Cannot start proxy server, already running")
return false, ErrAlreadyRunning
}
@@ -81,7 +81,7 @@ func (c *Client) Stop() (bool, error) {
c.mu.Lock()
defer c.mu.Unlock()
- if c.server == nil {
+ if !c.started || c.server == nil {
return false, ErrNotRunning
}
@@ -90,6 +90,7 @@ func (c *Client) Stop() (bool, error) {
return false, err
}
+ c.started = false
c.server = nil
return true, nil
}