From 47f28002ff341d14dc999d75c0c40fc5c0ce4d94 Mon Sep 17 00:00:00 2001 From: Niko Storni Date: Fri, 10 Jul 2020 15:19:57 +0200 Subject: [PATCH] close unclosed handle reduce idle timeout for http3 update QUIC library --- go.mod | 2 +- go.sum | 2 ++ peer/http3/server.go | 5 ++++- peer/http3/store.go | 1 + store/disk.go | 1 + 5 files changed, 9 insertions(+), 2 deletions(-) diff --git a/go.mod b/go.mod index 26f9f98..5c0fcec 100644 --- a/go.mod +++ b/go.mod @@ -22,7 +22,7 @@ require ( github.com/lbryio/lbry.go/v2 v2.4.5 github.com/lbryio/lbryschema.go v0.0.0-20190602173230-6d2f69a36f46 github.com/lbryio/types v0.0.0-20191228214437-05a22073b4ec - github.com/lucas-clemente/quic-go v0.17.1 + github.com/lucas-clemente/quic-go v0.17.2 github.com/phayes/freeport v0.0.0-20171002185219-e27662a4a9d6 github.com/prometheus/client_golang v0.9.2 github.com/sirupsen/logrus v1.4.2 diff --git a/go.sum b/go.sum index 6aef50f..56ea0a0 100644 --- a/go.sum +++ b/go.sum @@ -238,6 +238,8 @@ github.com/lbryio/types v0.0.0-20191228214437-05a22073b4ec/go.mod h1:CG3wsDv5BiV github.com/lib/pq v1.1.1/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= github.com/lucas-clemente/quic-go v0.17.1 h1:ezsH76xpn6hKugfsXUy6voIJBFmAOwnM/Oy9F4b/n+M= github.com/lucas-clemente/quic-go v0.17.1/go.mod h1:I0+fcNTdb9eS1ZcjQZbDVPGchJ86chcIxPALn9lEJqE= +github.com/lucas-clemente/quic-go v0.17.2 h1:4iQInIuNQkPNZmsy9rCnwuOzpH0qGnDo4jn0QfI/qE4= +github.com/lucas-clemente/quic-go v0.17.2/go.mod h1:I0+fcNTdb9eS1ZcjQZbDVPGchJ86chcIxPALn9lEJqE= github.com/lunixbochs/vtclean v1.0.0/go.mod h1:pHhQNgMf3btfWnGBVipUOjRYhoOsdGqdm/+2c2E2WMI= github.com/lusis/go-slackbot v0.0.0-20180109053408-401027ccfef5 h1:AsEBgzv3DhuYHI/GiQh2HxvTP71HCCE9E/tzGUzGdtU= github.com/lusis/go-slackbot v0.0.0-20180109053408-401027ccfef5/go.mod h1:c2mYKRyMb1BPkO5St0c/ps62L4S0W2NAkaTXj9qEI+0= diff --git a/peer/http3/server.go b/peer/http3/server.go index 9cc4f80..d415c14 100644 --- a/peer/http3/server.go +++ b/peer/http3/server.go @@ -63,7 +63,10 @@ type availabilityResponse struct { // Start starts the server listener to handle connections. func (s *Server) Start(address string) error { log.Println("HTTP3 peer listening on " + address) - quicConf := &quic.Config{HandshakeTimeout: 3 * time.Second} + quicConf := &quic.Config{ + HandshakeTimeout: 3 * time.Second, + MaxIdleTimeout: 5 * time.Second, + } r := mux.NewRouter() r.HandleFunc("/get/{hash}", func(w http.ResponseWriter, r *http.Request) { vars := mux.Vars(r) diff --git a/peer/http3/store.go b/peer/http3/store.go index cb68bb2..7b8e4fe 100644 --- a/peer/http3/store.go +++ b/peer/http3/store.go @@ -32,6 +32,7 @@ func NewStore(opts StoreOpts) *Store { func (p *Store) getClient() (*Client, error) { var qconf quic.Config qconf.HandshakeTimeout = 3 * time.Second + qconf.MaxIdleTimeout = 5 * time.Second pool, err := x509.SystemCertPool() if err != nil { return nil, err diff --git a/store/disk.go b/store/disk.go index 9b537d2..82e40ac 100644 --- a/store/disk.go +++ b/store/disk.go @@ -109,6 +109,7 @@ func (d *DiskBlobStore) Get(hash string) (stream.Blob, error) { } return nil, err } + defer file.Close() return ioutil.ReadAll(file) }