check_ethernet: perform ping check more selectively

We only intend to do this check

(a) initially; to see whether we need to do any recovery at all and
(b) after a recovery_method claims to have performed an action

For (b), this comes when the recovery_method returns 0 (success), and so
we move on to the latter phase of the loop.

Therefore, (a) can be moved outside the loop, saving time.

TEST=manual tests

Change-Id: I7f7ad380abca4675fc46bef4d125235c8f63dfa4
Tested-by: Brian Norris <>
Commit-Ready: ChromeOS CL Exonerator Bot <>
Legacy-Commit-Queue: Commit Bot <>
Reviewed-by: Grant Grundler <>
1 file changed