Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix bug with error being shadowed in Client.Start() #56

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions client.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,12 @@ func (client *Client) doSubscribe(topic string, fn interface{}, serverAddr, serv
}
}

//Subscribe subscribes to a topic in a remote event bus
// Subscribe subscribes to a topic in a remote event bus
func (client *Client) Subscribe(topic string, fn interface{}, serverAddr, serverPath string) {
client.doSubscribe(topic, fn, serverAddr, serverPath, Subscribe)
}

//SubscribeOnce subscribes once to a topic in a remote event bus
// SubscribeOnce subscribes once to a topic in a remote event bus
func (client *Client) SubscribeOnce(topic string, fn interface{}, serverAddr, serverPath string) {
client.doSubscribe(topic, fn, serverAddr, serverPath, SubscribeOnce)
}
Expand All @@ -84,12 +84,13 @@ func (client *Client) Start() error {
server := rpc.NewServer()
server.Register(service)
server.HandleHTTP(client.path, "/debug"+client.path)
l, err := net.Listen("tcp", client.address)
var l net.Listener
l, err = net.Listen("tcp", client.address)
if err == nil {
service.wg.Add(1)
service.started = true
go http.Serve(l, nil)
}
go http.Serve(l, nil)
}
} else {
err = errors.New("Client service already started")
}
Expand Down