fix(ndt7): discards all incoming websockets messages during upload (#719)
See https://github.com/ooni/probe/issues/2084
This commit is contained in:
parent
b7cc309901
commit
ded4b08113
|
@ -52,6 +52,15 @@ func (mgr uploadManager) run(ctx context.Context) error {
|
||||||
}
|
}
|
||||||
ticker := time.NewTicker(mgr.measureInterval)
|
ticker := time.NewTicker(mgr.measureInterval)
|
||||||
defer ticker.Stop()
|
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 {
|
for ctx.Err() == nil {
|
||||||
if err := mgr.conn.WritePreparedMessage(message); err != nil {
|
if err := mgr.conn.WritePreparedMessage(message); err != nil {
|
||||||
return err
|
return err
|
||||||
|
|
Loading…
Reference in New Issue
Block a user