fix(measurex): handle case where TH is nil (#610)
This case happens when the TH fails. See https://github.com/ooni/probe/issues/1895.
This commit is contained in:
parent
7f0fb5e619
commit
5b9f701317
|
@ -496,11 +496,14 @@ type ArchivalTHMeasurement struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewArchivalTHMeasurement creates the archival representation of THMeasurement.
|
// NewArchivalTHMeasurement creates the archival representation of THMeasurement.
|
||||||
func NewArchivalTHMeasurement(in *THMeasurement) *ArchivalTHMeasurement {
|
func NewArchivalTHMeasurement(in *THMeasurement) (out *ArchivalTHMeasurement) {
|
||||||
return &ArchivalTHMeasurement{
|
if in != nil {
|
||||||
DNS: NewArchivalDNSMeasurementList(in.DNS),
|
out = &ArchivalTHMeasurement{
|
||||||
Endpoints: NewArchivalHTTPEndpointMeasurementList(in.Endpoints),
|
DNS: NewArchivalDNSMeasurementList(in.DNS),
|
||||||
|
Endpoints: NewArchivalHTTPEndpointMeasurementList(in.Endpoints),
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
|
@ -31,7 +31,8 @@ type URLMeasurement struct {
|
||||||
// if we choose to follow redirections.
|
// if we choose to follow redirections.
|
||||||
RedirectURLs []string
|
RedirectURLs []string
|
||||||
|
|
||||||
// TH is the measurement collected by the TH.
|
// TH is the measurement collected by the TH. This field
|
||||||
|
// will be nil if we cannot contact the TH.
|
||||||
TH *THMeasurement
|
TH *THMeasurement
|
||||||
|
|
||||||
// TotalRuntime is the total time to measure this URL.
|
// TotalRuntime is the total time to measure this URL.
|
||||||
|
|
Loading…
Reference in New Issue
Block a user