net.lo: sleep *after* carrier check
For devices that are always connected (e.g. ethernet cards), the current carrier always wastes time by sleeping for 1 second. This is because the code sleeps first, then checks for carrier. Invert the order so that we return quickly for devices already active. For devices which are not yet up, there shouldn't be any real difference. Signed-off-by: Mike Frysinger <vapier@gentoo.org>
This commit is contained in:
parent
2c60282ba9
commit
7557d62870
@ -116,12 +116,12 @@ _wait_for_carrier()
|
||||
yesno ${RC_PARALLEL} && efunc=einfo
|
||||
${efunc} "Waiting for carrier (${timeout} seconds) "
|
||||
while [ ${timeout} -gt 0 ]; do
|
||||
sleep 1
|
||||
if _has_carrier; then
|
||||
[ "${efunc}" = "einfon" ] && echo
|
||||
eend 0
|
||||
return 0
|
||||
fi
|
||||
sleep 1
|
||||
: $(( timeout -= 1 ))
|
||||
[ "${efunc}" = "einfon" ] && printf "."
|
||||
done
|
||||
|
Loading…
Reference in New Issue
Block a user