unixchild - Ensure socket gets deleted on stop.

Project: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/repo
Commit: 
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/commit/9de7460f
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/tree/9de7460f
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/diff/9de7460f

Branch: refs/heads/master
Commit: 9de7460f1fc510d724a507692abcd8e45f9e5f02
Parents: 74d8512
Author: Christopher Collins <[email protected]>
Authored: Mon Apr 3 16:48:20 2017 -0700
Committer: Christopher Collins <[email protected]>
Committed: Mon Apr 3 16:53:26 2017 -0700

----------------------------------------------------------------------
 util/unixchild/unixchild.go | 2 ++
 1 file changed, 2 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/9de7460f/util/unixchild/unixchild.go
----------------------------------------------------------------------
diff --git a/util/unixchild/unixchild.go b/util/unixchild/unixchild.go
index b417187..91930c0 100644
--- a/util/unixchild/unixchild.go
+++ b/util/unixchild/unixchild.go
@@ -219,6 +219,7 @@ func (c *Client) Stop() {
 
        select {
        case <-c.stopped:
+               c.deleteSocket()
                c.state = CLIENT_STATE_STOPPED
                log.Debugf("Stopped client")
                return
@@ -246,6 +247,7 @@ func (c *Client) Start() error {
 
        l, err := net.Listen("unix", c.sockPath)
        if err != nil {
+               c.deleteSocket()
                return err
        }
 

Reply via email to