From ab46e73d3e50f94d27702bdff99eda3520ecd6f9 Mon Sep 17 00:00:00 2001 From: godblesshugh Date: Mon, 7 Nov 2016 17:25:45 +0800 Subject: [PATCH] trans errClosing into io.EOF to fix this expected error. --- service/buffer.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/service/buffer.go b/service/buffer.go index eb44488..132416a 100644 --- a/service/buffer.go +++ b/service/buffer.go @@ -20,6 +20,7 @@ import ( "io" "sync" "sync/atomic" + "net" ) var ( @@ -162,6 +163,12 @@ func (this *buffer) ReadFrom(r io.Reader) (int64, error) { } } + if opError, ok := err.(*net.OpError); ok { + if opError.Err.Error() == "use of closed network connection" { + return total, io.EOF + } + } + if err != nil { return total, err }