fix(ndt7): discards all incoming websockets messages during upload (#719)

See https://github.com/ooni/probe/issues/2084
This commit is contained in:
Yeganathan S 2022-05-12 06:18:05 +00:00 committed by GitHub
parent b7cc309901
commit ded4b08113
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -52,6 +52,15 @@ func (mgr uploadManager) run(ctx context.Context) error {
}
ticker := time.NewTicker(mgr.measureInterval)
defer ticker.Stop()
// goroutine that just reads and discards all incoming websockets messages
go func() {
for {
_, _, err := mgr.conn.NextReader()
if err != nil {
return
}
}
}()
for ctx.Err() == nil {
if err := mgr.conn.WritePreparedMessage(message); err != nil {
return err