handshake changes
This commit is contained in:
parent
09c7718f30
commit
fdcc41829a
4 changed files with 6 additions and 2 deletions
|
@ -53,7 +53,7 @@ func (s *Server) Start() {
|
|||
}
|
||||
|
||||
func (s *Server) Shutdown() {
|
||||
s.srv.Shutdown(context.Background())
|
||||
_ = s.srv.Shutdown(context.Background())
|
||||
s.stop.StopAndWait()
|
||||
}
|
||||
|
||||
|
|
|
@ -26,6 +26,7 @@ type Client struct {
|
|||
|
||||
// Close closes the connection with the client.
|
||||
func (c *Client) Close() error {
|
||||
c.conn.CloseIdleConnections()
|
||||
return c.roundTripper.Close()
|
||||
}
|
||||
|
||||
|
|
|
@ -9,6 +9,7 @@ import (
|
|||
"encoding/pem"
|
||||
"math/big"
|
||||
"net/http"
|
||||
"time"
|
||||
|
||||
"github.com/lbryio/reflector.go/internal/metrics"
|
||||
"github.com/lbryio/reflector.go/store"
|
||||
|
@ -61,13 +62,14 @@ 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{}
|
||||
quicConf := &quic.Config{HandshakeTimeout: 3 * time.Second}
|
||||
r := mux.NewRouter()
|
||||
r.HandleFunc("/get/{hash}", func(w http.ResponseWriter, r *http.Request) {
|
||||
vars := mux.Vars(r)
|
||||
requestedBlob := vars["hash"]
|
||||
blob, err := s.store.Get(requestedBlob)
|
||||
if err != nil {
|
||||
log.Errorln(errors.FullTrace(err))
|
||||
http.Error(w, err.Error(), http.StatusBadRequest)
|
||||
return
|
||||
}
|
||||
|
|
|
@ -31,6 +31,7 @@ func NewStore(opts StoreOpts) *Store {
|
|||
|
||||
func (p *Store) getClient() (*Client, error) {
|
||||
var qconf quic.Config
|
||||
qconf.HandshakeTimeout = 3 * time.Second
|
||||
pool, err := x509.SystemCertPool()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
|
Loading…
Reference in a new issue