Skip to content

Commit

Permalink
Keep an address string as is.
Browse files Browse the repository at this point in the history
  • Loading branch information
s-yata committed Jul 21, 2017
1 parent 3817f58 commit e0d0ce4
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions v2/gqtp.go
Original file line number Diff line number Diff line change
Expand Up @@ -391,25 +391,21 @@ func (c *GQTPConn) Query(cmd *Command) (Response, error) {

// GQTPClient is a thread-safe GQTP client.
type GQTPClient struct {
addr *Address
addr string
idleConns chan *GQTPConn
}

// NewGQTPClient returns a new GQTPClient connected to a GQTP server.
// The expected address format is [scheme://][host][:port].
func NewGQTPClient(addr string) (*GQTPClient, error) {
a, err := ParseGQTPAddress(addr)
if err != nil {
return nil, err
}
conn, err := DialGQTP(addr)
if err != nil {
return nil, err
}
conns := make(chan *GQTPConn, gqtpMaxIdleConns)
conns <- conn
return &GQTPClient{
addr: a,
addr: addr,
idleConns: conns,
}, nil
}
Expand Down Expand Up @@ -438,7 +434,7 @@ func (c *GQTPClient) exec(cmd string, body io.Reader) (Response, error) {
select {
case conn = <-c.idleConns:
default:
conn, err = DialGQTP(c.addr.String())
conn, err = DialGQTP(c.addr)
if err != nil {
return nil, err
}
Expand Down

0 comments on commit e0d0ce4

Please sign in to comment.