@@ -51,8 +51,8 @@ func (c *Client) add(group, name, node, service, version string) error {
5151 }
5252 // Node and service are required. Version is optional.
5353 if node == "" || service == "" {
54- return newError ( errAdd , " failed to add %s node?=%t, type?=%t" ,
55- name , node != "" , service != "" )
54+ format := "add failed for name= \" %s \" , node= \" %s \" , service= \" %s \" "
55+ return newError ( errAdd , format , name , node , service )
5656 }
5757 // Associate the node name with its service in the directory.
5858 c .directory [name ] = service
@@ -71,9 +71,9 @@ func (c *Client) add(group, name, node, service, version string) error {
7171 return nil
7272}
7373
74+ // Blocks until the required services are available to the client.
7475// Returns true if it had to block and false if it returns immediately.
7576func (c * Client ) block (services ... string ) bool {
76- // Block until the required services are available to the client.
7777 c .additions .Lock ()
7878 defer c .additions .Unlock ()
7979 // Even though the client may have just checked to see if services exist,
@@ -106,8 +106,7 @@ func (c *Client) Close() error {
106106 return newError (errLeave , err .Error ())
107107 }
108108 if err := c .node .Stop (); err != nil {
109- c .log .Warn ("sleuth: %s %s [%d]" ,
110- c .node .Name (), err .Error (), warnClose )
109+ c .log .Warn ("sleuth: %s %s [%d]" , c .node .Name (), err .Error (), warnClose )
111110 }
112111 return nil
113112}
@@ -260,8 +259,9 @@ func newClient(group string, node *gyre.Gyre, out *logger.Logger) *Client {
260259 directory : make (map [string ]string ),
261260 group : group ,
262261 listener : & listener {
263- new (sync.Mutex ),
264- make (map [string ]chan * http.Response )},
262+ Mutex : new (sync.Mutex ),
263+ handles : make (map [string ]chan * http.Response ),
264+ },
265265 log : out ,
266266 node : node ,
267267 Timeout : time .Millisecond * 500 ,
0 commit comments