You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dubbo.apache.org by al...@apache.org on 2021/01/02 19:03:49 UTC

[dubbo-go] branch develop updated: fix remoting linter error

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

alexstocks pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/dubbo-go.git


The following commit(s) were added to refs/heads/develop by this push:
     new c9a22b9  fix remoting linter error
c9a22b9 is described below

commit c9a22b9d6202e003e95359dd7289a452d96dd03f
Author: AlexStocks <al...@foxmail.com>
AuthorDate: Sun Jan 3 03:03:31 2021 +0800

    fix remoting linter error
---
 remoting/getty/getty_client_test.go |  7 +++++--
 remoting/getty/pool.go              | 20 +++++++++++++++-----
 2 files changed, 20 insertions(+), 7 deletions(-)

diff --git a/remoting/getty/getty_client_test.go b/remoting/getty/getty_client_test.go
index 0b18e97..982c509 100644
--- a/remoting/getty/getty_client_test.go
+++ b/remoting/getty/getty_client_test.go
@@ -87,7 +87,9 @@ func getClient(url *common.URL) *Client {
 
 	exchangeClient := remoting.NewExchangeClient(url, client, 5*time.Second, false)
 	client.SetExchangeClient(exchangeClient)
-	client.Connect(url)
+	if err := client.Connect(url); err != nil {
+		return nil
+	}
 	return client
 }
 
@@ -396,7 +398,8 @@ func InitTest(t *testing.T) (*Server, *common.URL) {
 		"side=provider&timeout=3000&timestamp=1556509797245&bean.name=UserProvider")
 	// init server
 	userProvider := &UserProvider{}
-	common.ServiceMap.Register("", url.Protocol, "", "0.0.1", userProvider)
+	_, err = common.ServiceMap.Register("", url.Protocol, "", "0.0.1", userProvider)
+	assert.NoError(t, err)
 	invoker := &proxy_factory.ProxyInvoker{
 		BaseInvoker: *protocol.NewBaseInvoker(url),
 	}
diff --git a/remoting/getty/pool.go b/remoting/getty/pool.go
index 9689175..c70aeea 100644
--- a/remoting/getty/pool.go
+++ b/remoting/getty/pool.go
@@ -149,13 +149,23 @@ func (c *gettyRPCClient) newSession(session getty.Session) error {
 		panic(fmt.Sprintf("%s, session.conn{%#v} is not tcp connection\n", session.Stat(), session.Conn()))
 	}
 
-	tcpConn.SetNoDelay(conf.GettySessionParam.TcpNoDelay)
-	tcpConn.SetKeepAlive(conf.GettySessionParam.TcpKeepAlive)
+	if err := tcpConn.SetNoDelay(conf.GettySessionParam.TcpNoDelay); err != nil {
+		logger.Error("tcpConn.SetNoDelay() = error:%v", err)
+	}
+	if err := tcpConn.SetKeepAlive(conf.GettySessionParam.TcpKeepAlive); err != nil {
+		logger.Error("tcpConn.SetKeepAlive() = error:%v", err)
+	}
 	if conf.GettySessionParam.TcpKeepAlive {
-		tcpConn.SetKeepAlivePeriod(conf.GettySessionParam.keepAlivePeriod)
+		if err := tcpConn.SetKeepAlivePeriod(conf.GettySessionParam.keepAlivePeriod); err != nil {
+			logger.Error("tcpConn.SetKeepAlivePeriod() = error:%v", err)
+		}
+	}
+	if err := tcpConn.SetReadBuffer(conf.GettySessionParam.TcpRBufSize); err != nil {
+		logger.Error("tcpConn.SetReadBuffer() = error:%v", err)
+	}
+	if err := tcpConn.SetWriteBuffer(conf.GettySessionParam.TcpWBufSize); err != nil {
+		logger.Error("tcpConn.SetWriteBuffer() = error:%v", err)
 	}
-	tcpConn.SetReadBuffer(conf.GettySessionParam.TcpRBufSize)
-	tcpConn.SetWriteBuffer(conf.GettySessionParam.TcpWBufSize)
 
 	session.SetName(conf.GettySessionParam.SessionName)
 	session.SetMaxMsgLen(conf.GettySessionParam.MaxMsgLen)