You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@servicecomb.apache.org by ti...@apache.org on 2020/02/20 11:48:33 UTC

[servicecomb-mesher] branch master updated: Dubbo protocol supports timeout configuration (#103)

This is an automated email from the ASF dual-hosted git repository.

tianxiaoliang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/servicecomb-mesher.git


The following commit(s) were added to refs/heads/master by this push:
     new 5c4f196  Dubbo protocol supports timeout configuration (#103)
5c4f196 is described below

commit 5c4f19625f0db904dae9a71d98df10776ba4e4a3
Author: t-xinlin <t_...@sina.com>
AuthorDate: Thu Feb 20 19:48:23 2020 +0800

    Dubbo protocol supports timeout configuration (#103)
    
    * Dubbo protocol supports timeout configuration
    
    * Dubbo protocol supports timeout configuration
    
    * Dubbo protocol supports timeout configuration
    
    * Dubbo protocol supports timeout configuration
---
 proxy/protocol/dubbo/client/dubbo_client.go | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)

diff --git a/proxy/protocol/dubbo/client/dubbo_client.go b/proxy/protocol/dubbo/client/dubbo_client.go
index 3e72282..5c6b893 100644
--- a/proxy/protocol/dubbo/client/dubbo_client.go
+++ b/proxy/protocol/dubbo/client/dubbo_client.go
@@ -142,17 +142,15 @@ func (this *DubboClient) Open() error {
 }
 
 func (this *DubboClient) open() error {
-	tcpAddr, err := net.ResolveTCPAddr("tcp", this.addr)
-	if err != nil {
-		lager.Logger.Error(err.Error())
-		return err
-	}
-	conn, errDial := net.DialTCP("tcp", nil, tcpAddr)
-
+	c, errDial := net.DialTimeout("tcp", this.addr, this.Timeout)
 	if errDial != nil {
 		lager.Logger.Errorf("the addr: %s %s ", this.addr, errDial)
 		return errDial
 	}
+	conn, ok := c.(*net.TCPConn)
+	if !ok {
+		return fmt.Errorf("not TCPConn type")
+	}
 	this.conn = NewDubboClientConnetction(conn, this, nil)
 	this.conn.Open()
 	this.closed = false