[Groonga-commit] groonga/grnci at b2de990 [master] libgrn: keep an address string as is.

Back to archive index

Susumu Yata null+****@clear*****
Fri Jul 21 16:30:43 JST 2017


Susumu Yata	2017-07-21 16:30:43 +0900 (Fri, 21 Jul 2017)

  New Revision: b2de990afb2b53e210c8942c567a86c78845a98f
  https://github.com/groonga/grnci/commit/b2de990afb2b53e210c8942c567a86c78845a98f

  Message:
    libgrn: keep an address string as is.

  Modified files:
    v2/libgrn/client.go

  Modified: v2/libgrn/client.go (+4 -8)
===================================================================
--- v2/libgrn/client.go    2017-07-21 16:27:11 +0900 (3c394d4)
+++ v2/libgrn/client.go    2017-07-21 16:30:43 +0900 (910a177)
@@ -12,7 +12,7 @@ const (
 
 // Client is a thread-safe GQTP client or DB handle.
 type Client struct {
-	addr      *grnci.Address
+	addr      string
 	baseConn  *Conn
 	idleConns chan *Conn
 }
@@ -20,10 +20,6 @@ type Client struct {
 // DialClient returns a new Client connected to a GQTP server.
 // The expected address format is [scheme://][host][:port].
 func DialClient(addr string) (*Client, error) {
-	a, err := grnci.ParseGQTPAddress(addr)
-	if err != nil {
-		return nil, err
-	}
 	conn, err := Dial(addr)
 	if err != nil {
 		return nil, err
@@ -31,7 +27,7 @@ func DialClient(addr string) (*Client, error) {
 	conns := make(chan *Conn, maxIdleConns)
 	conns <- conn
 	return &Client{
-		addr:      a,
+		addr:      addr,
 		idleConns: conns,
 	}, nil
 }
@@ -89,8 +85,8 @@ func (c *Client) exec(cmd string, body io.Reader) (grnci.Response, error) {
 	select {
 	case conn = <-c.idleConns:
 	default:
-		if c.addr != nil {
-			conn, err = Dial(c.addr.String())
+		if c.baseConn == nil {
+			conn, err = Dial(c.addr)
 			if err != nil {
 				return nil, err
 			}
-------------- next part --------------
HTML����������������������������...
Download 



More information about the Groonga-commit mailing list
Back to archive index