From 8363be85486e97053cdac45e9d0a692fe76af02e Mon Sep 17 00:00:00 2001 From: Chris Lu Date: Sat, 6 Mar 2021 14:25:05 -0800 Subject: [PATCH] trim out trailing return character --- weed/server/volume_server_tcp_handlers_write.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/weed/server/volume_server_tcp_handlers_write.go b/weed/server/volume_server_tcp_handlers_write.go index 7c2f1a77f..a009611da 100644 --- a/weed/server/volume_server_tcp_handlers_write.go +++ b/weed/server/volume_server_tcp_handlers_write.go @@ -6,6 +6,7 @@ import ( "github.com/chrislusf/seaweedfs/weed/glog" "github.com/chrislusf/seaweedfs/weed/storage/needle" "github.com/chrislusf/seaweedfs/weed/util" + "io" "net" "strings" ) @@ -21,9 +22,12 @@ func (vs *VolumeServer) HandleTcpConnection(c net.Conn) { for { cmd, err := bufReader.ReadString('\n') if err != nil { - glog.Errorf("read command from %s: %v", c.RemoteAddr().String(), err) + if err != io.EOF { + glog.Errorf("read command from %s: %v", c.RemoteAddr().String(), err) + } return } + cmd = cmd[:len(cmd)-1] switch cmd[0] { case '+': fileId := cmd[1:]