From 947492a71c80c9dccd9915b051612e32bdef980d Mon Sep 17 00:00:00 2001 From: Darien Raymond Date: Wed, 5 Apr 2017 11:02:49 +0200 Subject: [PATCH 1/2] close all sessions after main connection ends --- app/proxyman/mux/mux.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/app/proxyman/mux/mux.go b/app/proxyman/mux/mux.go index 23ac4707..d8fd9fac 100644 --- a/app/proxyman/mux/mux.go +++ b/app/proxyman/mux/mux.go @@ -271,6 +271,15 @@ func (m *Client) fetchOutput() { break } } + + // Close all downlinks + m.access.RLock() + for _, s := range m.sessions { + s.closeUplink() + s.closeDownlink() + s.output.CloseError() + } + m.access.RUnlock() } type Server struct { From 0a15bceb55edc8f38a8145d80f46e6c1c299ff5b Mon Sep 17 00:00:00 2001 From: Darien Raymond Date: Wed, 5 Apr 2017 12:56:50 +0200 Subject: [PATCH 2/2] fix dead lock --- app/proxyman/mux/mux.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/proxyman/mux/mux.go b/app/proxyman/mux/mux.go index d8fd9fac..0c705e65 100644 --- a/app/proxyman/mux/mux.go +++ b/app/proxyman/mux/mux.go @@ -42,7 +42,7 @@ func (s *session) closeUplink() { allDone = s.uplinkClosed && s.downlinkClosed s.Unlock() if allDone { - s.parent.remove(s.id) + go s.parent.remove(s.id) } } @@ -53,7 +53,7 @@ func (s *session) closeDownlink() { allDone = s.uplinkClosed && s.downlinkClosed s.Unlock() if allDone { - s.parent.remove(s.id) + go s.parent.remove(s.id) } }