Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
rbarazzutti committed Aug 20, 2023
1 parent fa5af6b commit 585aff3
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
12 changes: 11 additions & 1 deletion app/pinglogger.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ type logger interface {
onTick(measure throughputMeasure)
onClose()
onThroughputClose()
out() io.Writer
}

type measures struct {
Expand All @@ -45,6 +46,10 @@ type quietLogger struct {
throughputMeasures []throughputMeasure
}

func (logger *quietLogger) out() io.Writer {
return logger.stdout
}

func newQuietLogger(config *Config, stdout io.Writer, pinger Pinger) logger {
return &quietLogger{config: config, stdout: stdout, pinger: pinger}
}
Expand Down Expand Up @@ -115,6 +120,11 @@ type standardLogger struct {
quietLogger
}

func (logger *standardLogger) out() io.Writer {
//TODO implement me
panic("implement me")
}

func newStandardLogger(config *Config, stdout io.Writer, pinger Pinger) *standardLogger {
return &standardLogger{quietLogger{config: config, stdout: stdout, pinger: pinger}}
}
Expand All @@ -134,7 +144,7 @@ func (logger *standardLogger) onMeasure(measure *HTTPMeasure) {

func (logger *standardLogger) onTick(m throughputMeasure) {
logger.quietLogger.onTick(m)
fmt.Printf(" throughput: %s queries/sec, average latency: %.1f ms\n", m.String(), m.queriesDuration.ToFloat(time.Microsecond)/float64(1000*m.count))
_, _ = fmt.Fprintf(logger.stdout, " throughput: %s queries/sec, average latency: %.1f ms\n", m.String(), m.queriesDuration.ToFloat(time.Microsecond)/float64(1000*m.count))
}

func (logger *standardLogger) onClose() {
Expand Down
2 changes: 1 addition & 1 deletion app/webclientimpl.go
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ func (webClient *webClientImpl) DoMeasure(followRedirect bool) *HTTPMeasure {

altSvcH3 := checkAltSvcH3Header(res.Header)

if req.TLS != nil && altSvcH3 != nil && !strings.HasPrefix(res.Proto, "HTTP/3") && !webClient.config.Http1 && !webClient.config.Http2 {
if !strings.HasPrefix(req.RequestURI, "http://") && altSvcH3 != nil && !strings.HasPrefix(res.Proto, "HTTP/3") && !webClient.config.Http1 && !webClient.config.Http2 {
_, _ = fmt.Printf(" ─→ server advertised HTTP/3 endpoint, using HTTP/3\n")

return webClient.moveToHttp3(*altSvcH3, measureContext.timerRegistry, followRedirect)
Expand Down

0 comments on commit 585aff3

Please sign in to comment.