feat(torsf): add default_timeout test keys (#709)
See https://github.com/ooni/probe/issues/2061
This commit is contained in:
parent
4c55102789
commit
b81af5b058
|
@ -42,6 +42,9 @@ type TestKeys struct {
|
||||||
// BootstrapTime contains the bootstrap time on success.
|
// BootstrapTime contains the bootstrap time on success.
|
||||||
BootstrapTime float64 `json:"bootstrap_time"`
|
BootstrapTime float64 `json:"bootstrap_time"`
|
||||||
|
|
||||||
|
// DefaultTimeout contains the default timeout for torsf
|
||||||
|
DefaultTimeout float64 `json:"default_timeout"`
|
||||||
|
|
||||||
// Failure contains the failure string or nil.
|
// Failure contains the failure string or nil.
|
||||||
Failure *string `json:"failure"`
|
Failure *string `json:"failure"`
|
||||||
|
|
||||||
|
@ -113,7 +116,7 @@ func (m *Measurer) Run(
|
||||||
tkch := make(chan *TestKeys)
|
tkch := make(chan *TestKeys)
|
||||||
ticker := time.NewTicker(2 * time.Second)
|
ticker := time.NewTicker(2 * time.Second)
|
||||||
defer ticker.Stop()
|
defer ticker.Stop()
|
||||||
go m.bootstrap(ctx, sess, tkch, ptl, sfdialer)
|
go m.bootstrap(ctx, maxRuntime, sess, tkch, ptl, sfdialer)
|
||||||
for {
|
for {
|
||||||
select {
|
select {
|
||||||
case tk := <-tkch:
|
case tk := <-tkch:
|
||||||
|
@ -159,10 +162,11 @@ func (m *Measurer) setup(ctx context.Context,
|
||||||
}
|
}
|
||||||
|
|
||||||
// bootstrap runs the bootstrap.
|
// bootstrap runs the bootstrap.
|
||||||
func (m *Measurer) bootstrap(ctx context.Context, sess model.ExperimentSession,
|
func (m *Measurer) bootstrap(ctx context.Context, timeout time.Duration, sess model.ExperimentSession,
|
||||||
out chan<- *TestKeys, ptl *ptx.Listener, sfdialer *ptx.SnowflakeDialer) {
|
out chan<- *TestKeys, ptl *ptx.Listener, sfdialer *ptx.SnowflakeDialer) {
|
||||||
tk := &TestKeys{
|
tk := &TestKeys{
|
||||||
BootstrapTime: 0,
|
BootstrapTime: 0,
|
||||||
|
DefaultTimeout: timeout.Seconds(),
|
||||||
Failure: nil,
|
Failure: nil,
|
||||||
PersistentDatadir: !m.config.DisablePersistentDatadir,
|
PersistentDatadir: !m.config.DisablePersistentDatadir,
|
||||||
RendezvousMethod: sfdialer.RendezvousMethod.Name(),
|
RendezvousMethod: sfdialer.RendezvousMethod.Name(),
|
||||||
|
|
Loading…
Reference in New Issue
Block a user