From e064ce65c8aa01a681e67b4bbf324e4280a42c25 Mon Sep 17 00:00:00 2001 From: Darien Raymond Date: Sun, 16 Apr 2017 13:24:02 +0200 Subject: [PATCH] handle error properly --- app/proxyman/mux/mux.go | 6 +++++- app/proxyman/mux/session.go | 4 ++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/app/proxyman/mux/mux.go b/app/proxyman/mux/mux.go index f8377dd6..8db25918 100644 --- a/app/proxyman/mux/mux.go +++ b/app/proxyman/mux/mux.go @@ -4,6 +4,7 @@ package mux import ( "context" + "io" "sync" "time" @@ -12,6 +13,7 @@ import ( "v2ray.com/core/app/log" "v2ray.com/core/app/proxyman" "v2ray.com/core/common/buf" + "v2ray.com/core/common/errors" "v2ray.com/core/common/net" "v2ray.com/core/common/signal" "v2ray.com/core/proxy" @@ -239,7 +241,9 @@ func (m *Client) fetchOutput() { for { meta, err := reader.ReadMetadata() if err != nil { - log.Trace(newError("failed to read metadata").Base(err)) + if errors.Cause(err) != io.EOF { + log.Trace(newError("failed to read metadata").Base(err)) + } break } diff --git a/app/proxyman/mux/session.go b/app/proxyman/mux/session.go index 963ae5fd..23deec62 100644 --- a/app/proxyman/mux/session.go +++ b/app/proxyman/mux/session.go @@ -97,8 +97,8 @@ func (m *SessionManager) Close() { m.closed = true for _, s := range m.sessions { - s.input.CloseError() - s.output.CloseError() + s.input.Close() + s.output.Close() } m.sessions = make(map[uint16]*Session)