refactor(measurexlite): make buffered channels private (#864)
Closes https://github.com/ooni/probe/issues/2215
This commit is contained in:
@@ -182,7 +182,7 @@ func (m *Measurer) quicHandshake(ctx context.Context, index int64,
|
||||
}
|
||||
_, err := dialer.DialContext(ctx, "udp", address, tlsConfig, &quic.Config{})
|
||||
ol.Stop(err)
|
||||
sp.QUICHandshake = <-trace.QUICHandshake
|
||||
sp.QUICHandshake = trace.FirstQUICHandshakeOrNil() // record the first handshake from the buffer
|
||||
sp.NetworkEvents = append(sp.NetworkEvents, trace.NetworkEvents()...)
|
||||
return sp
|
||||
}
|
||||
|
||||
@@ -141,7 +141,7 @@ func (m *Measurer) tcpConnect(ctx context.Context, index int64,
|
||||
ol.Stop(err)
|
||||
measurexlite.MaybeClose(conn)
|
||||
sp := &SinglePing{
|
||||
TCPConnect: <-trace.TCPConnect,
|
||||
TCPConnect: trace.FirstTCPConnectOrNil(), // record the first connect from the buffer
|
||||
}
|
||||
return sp
|
||||
}
|
||||
|
||||
@@ -176,7 +176,7 @@ func (m *Measurer) tlsConnectAndHandshake(ctx context.Context, index int64,
|
||||
sni := m.config.sni(address)
|
||||
ol := measurexlite.NewOperationLogger(logger, "TLSPing #%d %s %s %v", index, address, sni, alpn)
|
||||
conn, err := dialer.DialContext(ctx, "tcp", address)
|
||||
sp.TCPConnect = <-trace.TCPConnect
|
||||
sp.TCPConnect = trace.FirstTCPConnectOrNil() // record the first connect from the buffer
|
||||
if err != nil {
|
||||
ol.Stop(err)
|
||||
return sp
|
||||
@@ -191,7 +191,7 @@ func (m *Measurer) tlsConnectAndHandshake(ctx context.Context, index int64,
|
||||
}
|
||||
_, _, err = thx.Handshake(ctx, conn, config)
|
||||
ol.Stop(err)
|
||||
sp.TLSHandshake = <-trace.TLSHandshake
|
||||
sp.TLSHandshake = trace.FirstTLSHandshakeOrNil() // record the first handshake from the buffer
|
||||
sp.NetworkEvents = trace.NetworkEvents()
|
||||
return sp
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user