Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
scion/ping: wait for send go routine to terminate (#4392)
Wait for the ping sender go routine to terminate before we return the stats. With bad luck, the receiver go routine receives all the replies before the sender go routine has terminated. Because only the sender go routine increments the stats.Sent count, we end up with wrong stats that claim more packets were received then sent. The race condition is that `WriteTo` in the last `pinger.send` succeeds, but then the writer go-routine is not scheduled to increment the `stats.Sent` counter before these stats are returned from `pinger.Ping`.
- Loading branch information