()
| 34 | } |
| 35 | |
| 36 | func (c *commandCenter) Start() (err error) { |
| 37 | if c.listener, err = net.Listen(c.Network, c.SocketPath); err != nil { |
| 38 | if c.Network == "unix" && strings.Contains(err.Error(), "address already in use") { |
| 39 | err = fmt.Errorf("it looks like Overmind is already running. If it's not, remove %s and try again", c.SocketPath) |
| 40 | } |
| 41 | return |
| 42 | } |
| 43 | |
| 44 | go func(c *commandCenter) { |
| 45 | for { |
| 46 | if conn, err := c.listener.Accept(); err == nil { |
| 47 | go c.handleConnection(conn) |
| 48 | } |
| 49 | |
| 50 | if c.stop { |
| 51 | break |
| 52 | } |
| 53 | } |
| 54 | }(c) |
| 55 | |
| 56 | return nil |
| 57 | } |
| 58 | |
| 59 | func (c *commandCenter) Stop() { |
| 60 | c.stop = true |
nothing calls this directly
no test coverage detected