Skip to content

Commit

Permalink
Improvment of the error catching
Browse files Browse the repository at this point in the history
  • Loading branch information
CriJonsi committed Mar 13, 2018
1 parent 5b84a63 commit dda45d4
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions client.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,15 +84,12 @@ func (client *Client) Start() error {
server := rpc.NewServer()
server.Register(service)
server.HandleHTTP(client.path, "/debug"+client.path)
l, e := net.Listen("tcp", client.address)
if e != nil {
err = e
fmt.Errorf("listen error: %v", e)
return e
}
service.wg.Add(1)
service.started = true
go http.Serve(l, nil)
l, err := net.Listen("tcp", client.address)
if err == nil {
service.wg.Add(1)
service.started = true
go http.Serve(l, nil)
}
} else {
err = errors.New("Client service already started")
}
Expand Down

0 comments on commit dda45d4

Please sign in to comment.