diff --git a/core/connection.go b/core/connection.go index 97f6703..00e48aa 100644 --- a/core/connection.go +++ b/core/connection.go @@ -8,6 +8,7 @@ import ( "git.noahlan.cn/noahlan/nnet/scheduler" "git.noahlan.cn/noahlan/ntools-go/core/nlog" "git.noahlan.cn/noahlan/ntools-go/core/pool" + "io" "net" "sync/atomic" ) @@ -199,12 +200,11 @@ func (r *connection) read() { defer func() { _ = r.Close() }() - buf := make([]byte, 4096) for { n, err := r.conn.Read(buf) //nlog.Debugf("receive data %v", buf[:n]) - if err != nil { + if err != nil && err != io.EOF { nlog.Errorf("%s [readLoop] Read message error: %s, session will be closed immediately", r.ngin.logPrefix(), err.Error()) return