summaryrefslogtreecommitdiff
path: root/networkQuality.go
diff options
context:
space:
mode:
authorWill Hawkins <[email protected]>2023-07-19 10:45:53 -0400
committerWill Hawkins <[email protected]>2023-07-19 10:45:53 -0400
commit4a3b5c9ab262a6c029c04a6d1e7f6fe038ee9e63 (patch)
tree2648458225ee1c37e2e5f6743b2aab77ff3bcc63 /networkQuality.go
parentcca033fe0d7389bfa647afa47a47de2a3f6af47d (diff)
[Feature] Add extended-stats for uploads
Now that tests are run in sequence, it seems like a good idea to support extended statistics in both directions. Fixes #58 h/t @moeller0 Signed-off-by: Will Hawkins <[email protected]>
Diffstat (limited to 'networkQuality.go')
-rw-r--r--networkQuality.go21
1 files changed, 14 insertions, 7 deletions
diff --git a/networkQuality.go b/networkQuality.go
index ed9dcfa..1e6590b 100644
--- a/networkQuality.go
+++ b/networkQuality.go
@@ -432,8 +432,7 @@ func main() {
downloadDirection.Lgcc = lgc.NewLoadGeneratingConnectionCollection()
uploadDirection.Lgcc = lgc.NewLoadGeneratingConnectionCollection()
- // We do not do tracing on upload connections so there are no extended stats for those connections!
- uploadDirection.ExtendedStatsEligible = false
+ uploadDirection.ExtendedStatsEligible = true
downloadDirection.ExtendedStatsEligible = true
generateSelfProbeConfiguration := func() probe.ProbeConfiguration {
@@ -956,24 +955,32 @@ func main() {
direction.Lgcc.Lock.Lock()
defer direction.Lgcc.Lock.Unlock()
- // Note: We do not trace upload connections!
- downloadLgcCount, err := direction.Lgcc.Len()
+ lgcCount, err := direction.Lgcc.Len()
if err != nil {
fmt.Fprintf(
os.Stderr,
- "Warning: Could not calculate the number of download load-generating connections; aborting extended stats preparation.\n",
+ "Warning: Could not calculate the number of %v load-generating connections; aborting extended stats preparation.\n", direction.DirectionLabel,
)
return
}
- for i := 0; i < downloadLgcCount; i++ {
+
+ for i := 0; i < lgcCount; i++ {
// Assume that extended statistics are available -- the check was done explicitly at
// program startup if the calculateExtendedStats flag was set by the user on the command line.
currentLgc, _ := direction.Lgcc.Get(i)
+
+ if currentLgc == nil || (*currentLgc).Stats() == nil {
+ fmt.Fprintf(
+ os.Stderr,
+ "Warning: Could not add extended stats for the connection: The LGC was nil or there were no stats available.\n",
+ )
+ continue
+ }
if err := extendedStats.IncorporateConnectionStats(
(*currentLgc).Stats().ConnInfo.Conn); err != nil {
fmt.Fprintf(
os.Stderr,
- "Warning: Could not add extended stats for the connection: %v\n",
+ "Warning: Could not add extended stats for the connection: %v.\n",
err,
)
}