File tree Expand file tree Collapse file tree 1 file changed +5
-9
lines changed Expand file tree Collapse file tree 1 file changed +5
-9
lines changed Original file line number Diff line number Diff line change 77 "net/url"
88 "strings"
99 "sync"
10+ "time"
1011
1112 "github.com/labstack/echo/v4"
1213 "github.com/shellhub-io/shellhub/pkg/api/internalclient"
@@ -164,15 +165,9 @@ func (h *Handlers) HandleHTTPProxy(c echo.Context) error {
164165 var wg sync.WaitGroup
165166 wg .Add (2 )
166167
167- done := sync .OnceFunc (func () {
168- // underlying connection closed by done() after copy
169- defer out .Close ()
170-
171- logger .Trace ("close called on in and out connections" )
172- })
168+ starTime := time .Now ()
173169
174170 go func () {
175- defer done ()
176171 defer wg .Done ()
177172
178173 if _ , err := io .Copy (conn , out ); err != nil {
@@ -183,7 +178,6 @@ func (h *Handlers) HandleHTTPProxy(c echo.Context) error {
183178 }()
184179
185180 go func () {
186- defer done ()
187181 defer wg .Done ()
188182
189183 if _ , err := io .Copy (out , conn ); err != nil {
@@ -195,7 +189,9 @@ func (h *Handlers) HandleHTTPProxy(c echo.Context) error {
195189
196190 wg .Wait ()
197191
198- logger .Debug ("http proxy is done" )
192+ logger .WithFields (log.Fields {
193+ "duration" : time .Since (starTime ).String (),
194+ }).Info ("web endpoint request completed" )
199195
200196 return nil
201197}
You can’t perform that action at this time.
0 commit comments