style: remove dead code comments and move comments
All checks were successful
CI / build (push) Successful in 51s
All checks were successful
CI / build (push) Successful in 51s
This commit is contained in:
parent
c50e482085
commit
1045548164
1 changed files with 11 additions and 10 deletions
|
@ -34,6 +34,7 @@ type ConnectionWatcher struct {
|
||||||
var h3s bool
|
var h3s bool
|
||||||
var version string
|
var version string
|
||||||
var cw ConnectionWatcher
|
var cw ConnectionWatcher
|
||||||
|
var tx uint64
|
||||||
|
|
||||||
// https://stackoverflow.com/questions/51317122/how-to-get-number-of-idle-and-active-connections-in-go
|
// https://stackoverflow.com/questions/51317122/how-to-get-number-of-idle-and-active-connections-in-go
|
||||||
// OnStateChange records open connections in response to connection
|
// OnStateChange records open connections in response to connection
|
||||||
|
@ -44,15 +45,11 @@ func (cw *ConnectionWatcher) OnStateChange(conn net.Conn, state http.ConnState)
|
||||||
case http.StateNew:
|
case http.StateNew:
|
||||||
metrics.Metrics.EstablishedConnections.Inc()
|
metrics.Metrics.EstablishedConnections.Inc()
|
||||||
metrics.Metrics.TotalConnEstablished.Inc()
|
metrics.Metrics.TotalConnEstablished.Inc()
|
||||||
// case http.StateActive:
|
|
||||||
// atomic.AddInt64(&cw.active, 1)
|
|
||||||
case http.StateClosed, http.StateHijacked:
|
case http.StateClosed, http.StateHijacked:
|
||||||
metrics.Metrics.EstablishedConnections.Dec()
|
metrics.Metrics.EstablishedConnections.Dec()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var tx uint64
|
|
||||||
|
|
||||||
func blockCheckerCalc(p *procfs.Proc) {
|
func blockCheckerCalc(p *procfs.Proc) {
|
||||||
var last uint64
|
var last uint64
|
||||||
for {
|
for {
|
||||||
|
@ -274,13 +271,15 @@ func main() {
|
||||||
|
|
||||||
srvh3 := &http3.Server{
|
srvh3 := &http3.Server{
|
||||||
Handler: mux,
|
Handler: mux,
|
||||||
EnableDatagrams: false, // https://quic.video/blog/never-use-datagrams/ (Read it)
|
// https://quic.video/blog/never-use-datagrams/ (Read it)
|
||||||
|
EnableDatagrams: false,
|
||||||
IdleTimeout: 120 * time.Second,
|
IdleTimeout: 120 * time.Second,
|
||||||
TLSConfig: http3.ConfigureTLSConfig(&tls.Config{}),
|
TLSConfig: http3.ConfigureTLSConfig(&tls.Config{}),
|
||||||
QUICConfig: &quic.Config{
|
QUICConfig: &quic.Config{
|
||||||
// KeepAlivePeriod: 10 * time.Second,
|
// I'm not sure if this is correct.
|
||||||
MaxIncomingStreams: 256, // I'm not sure if this is correct.
|
MaxIncomingStreams: 256,
|
||||||
MaxIncomingUniStreams: 256, // Same as above
|
// Same as above.
|
||||||
|
MaxIncomingUniStreams: 256,
|
||||||
},
|
},
|
||||||
Addr: host + ":" + port,
|
Addr: host + ":" + port,
|
||||||
}
|
}
|
||||||
|
@ -292,6 +291,7 @@ func main() {
|
||||||
log.Println("Failed to bind to UDS, please check the socket name", err.Error())
|
log.Println("Failed to bind to UDS, please check the socket name", err.Error())
|
||||||
} else {
|
} else {
|
||||||
defer socket_listener.Close()
|
defer socket_listener.Close()
|
||||||
|
|
||||||
// To allow everyone to access the socket
|
// To allow everyone to access the socket
|
||||||
err = os.Chmod(sock, 0777)
|
err = os.Chmod(sock, 0777)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -318,7 +318,7 @@ func main() {
|
||||||
|
|
||||||
go func() {
|
go func() {
|
||||||
if err := srv.ListenAndServeTLS(tls_cert, tls_key); err != nil {
|
if err := srv.ListenAndServeTLS(tls_cert, tls_key); err != nil {
|
||||||
log.Fatal("Failed to server HTTP/2", err.Error())
|
log.Fatal("Failed to serve HTTP/2", err.Error())
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
|
||||||
|
@ -330,6 +330,7 @@ func main() {
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
}
|
}
|
||||||
|
|
||||||
select {}
|
select {}
|
||||||
} else {
|
} else {
|
||||||
log.Println("Serving HTTP at port", string(port))
|
log.Println("Serving HTTP at port", string(port))
|
||||||
|
|
Loading…
Add table
Reference in a new issue