rocketmq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ding...@apache.org
Subject [rocketmq-client-go] branch native updated: feat: ignore eof err (#450)
Date Wed, 18 Mar 2020 08:23:45 GMT
This is an automated email from the ASF dual-hosted git repository.

dinglei pushed a commit to branch native
in repository https://gitbox.apache.org/repos/asf/rocketmq-client-go.git


The following commit(s) were added to refs/heads/native by this push:
     new 267dca5  feat: ignore eof err (#450)
267dca5 is described below

commit 267dca5cad5454f96e94670216086c967a613e55
Author: xujianhai666 <52450794+xujianhai666@users.noreply.github.com>
AuthorDate: Wed Mar 18 16:23:35 2020 +0800

    feat: ignore eof err (#450)
    
    Closes #443
---
 internal/remote/remote_client.go | 30 ++++++++----------------------
 1 file changed, 8 insertions(+), 22 deletions(-)

diff --git a/internal/remote/remote_client.go b/internal/remote/remote_client.go
index 302b5e5..7b5b1ea 100644
--- a/internal/remote/remote_client.go
+++ b/internal/remote/remote_client.go
@@ -141,32 +141,28 @@ func (c *remotingClient) receiveResponse(r *tcpConnWrapper) {
 	defer primitive.BackHeader(header)
 	for {
 		if err != nil {
+			// conn has been closed actively
 			if r.isClosed(err) {
 				return
 			}
-			rlog.Error("conn error, close connection", map[string]interface{}{
-				rlog.LogKeyUnderlayError: err,
-			})
+			if err != io.EOF {
+				rlog.Error("conn error, close connection", map[string]interface{}{
+					rlog.LogKeyUnderlayError: err,
+				})
+			}
+			c.closeConnection(r)
+			r.destroy()
 			break
 		}
 
 		_, err = io.ReadFull(r, header)
 		if err != nil {
-			if r.isClosed(err) {
-				return
-			}
-			rlog.Error("io ReadFull error when read header", map[string]interface{}{
-				rlog.LogKeyUnderlayError: err,
-			})
 			continue
 		}
 
 		var length int32
 		err = binary.Read(bytes.NewReader(header), binary.BigEndian, &length)
 		if err != nil {
-			rlog.Error("binary decode header error", map[string]interface{}{
-				rlog.LogKeyUnderlayError: err,
-			})
 			continue
 		}
 
@@ -174,12 +170,6 @@ func (c *remotingClient) receiveResponse(r *tcpConnWrapper) {
 
 		_, err = io.ReadFull(r, buf)
 		if err != nil {
-			if r.isClosed(err) {
-				return
-			}
-			rlog.Error("io ReadFull error when read payload", map[string]interface{}{
-				rlog.LogKeyUnderlayError: err,
-			})
 			continue
 		}
 
@@ -318,10 +308,6 @@ func (c *remotingClient) ShutDown() {
 				"remote":                 conn.RemoteAddr(),
 				rlog.LogKeyUnderlayError: err,
 			})
-		} else {
-			rlog.Info("remoting conn closed", map[string]interface{}{
-				"remote": conn.RemoteAddr(),
-			})
 		}
 		return true
 	})


Mime
View raw message