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() {
|
func (s *Server) Shutdown() {
|
||||||
s.srv.Shutdown(context.Background())
|
_ = s.srv.Shutdown(context.Background())
|
||||||
s.stop.StopAndWait()
|
s.stop.StopAndWait()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -26,6 +26,7 @@ type Client struct {
|
||||||
|
|
||||||
// Close closes the connection with the client.
|
// Close closes the connection with the client.
|
||||||
func (c *Client) Close() error {
|
func (c *Client) Close() error {
|
||||||
|
c.conn.CloseIdleConnections()
|
||||||
return c.roundTripper.Close()
|
return c.roundTripper.Close()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -9,6 +9,7 @@ import (
|
||||||
"encoding/pem"
|
"encoding/pem"
|
||||||
"math/big"
|
"math/big"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
"time"
|
||||||
|
|
||||||
"github.com/lbryio/reflector.go/internal/metrics"
|
"github.com/lbryio/reflector.go/internal/metrics"
|
||||||
"github.com/lbryio/reflector.go/store"
|
"github.com/lbryio/reflector.go/store"
|
||||||
|
@ -61,13 +62,14 @@ type availabilityResponse struct {
|
||||||
// Start starts the server listener to handle connections.
|
// Start starts the server listener to handle connections.
|
||||||
func (s *Server) Start(address string) error {
|
func (s *Server) Start(address string) error {
|
||||||
log.Println("HTTP3 peer listening on " + address)
|
log.Println("HTTP3 peer listening on " + address)
|
||||||
quicConf := &quic.Config{}
|
quicConf := &quic.Config{HandshakeTimeout: 3 * time.Second}
|
||||||
r := mux.NewRouter()
|
r := mux.NewRouter()
|
||||||
r.HandleFunc("/get/{hash}", func(w http.ResponseWriter, r *http.Request) {
|
r.HandleFunc("/get/{hash}", func(w http.ResponseWriter, r *http.Request) {
|
||||||
vars := mux.Vars(r)
|
vars := mux.Vars(r)
|
||||||
requestedBlob := vars["hash"]
|
requestedBlob := vars["hash"]
|
||||||
blob, err := s.store.Get(requestedBlob)
|
blob, err := s.store.Get(requestedBlob)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
log.Errorln(errors.FullTrace(err))
|
||||||
http.Error(w, err.Error(), http.StatusBadRequest)
|
http.Error(w, err.Error(), http.StatusBadRequest)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,6 +31,7 @@ func NewStore(opts StoreOpts) *Store {
|
||||||
|
|
||||||
func (p *Store) getClient() (*Client, error) {
|
func (p *Store) getClient() (*Client, error) {
|
||||||
var qconf quic.Config
|
var qconf quic.Config
|
||||||
|
qconf.HandshakeTimeout = 3 * time.Second
|
||||||
pool, err := x509.SystemCertPool()
|
pool, err := x509.SystemCertPool()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
|
Loading…
Add table
Reference in a new issue