From 30f7f4636ec8312b8f14fa6c7de9257614fc2484 Mon Sep 17 00:00:00 2001 From: Christine Dodrill Date: Wed, 4 Oct 2017 15:46:17 -0700 Subject: [PATCH] tun2: close http streams after 30 minutes --- internal/tun2/connection.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/internal/tun2/connection.go b/internal/tun2/connection.go index b68cfe4..40f7c4d 100644 --- a/internal/tun2/connection.go +++ b/internal/tun2/connection.go @@ -127,6 +127,12 @@ func (c *Connection) RoundTrip(req *http.Request) (*http.Response, error) { return nil, errors.Wrap(err, ErrCantOpenSessionStream.Error()) } + go func() { + time.Sleep(30 * time.Minute) + + stream.Close() + }() + err = req.Write(stream) if err != nil { return nil, errors.Wrap(err, ErrCantWriteRequest.Error())