Commit 6e730c16 authored by Tails developers's avatar Tails developers

Simplify waiting code to avoid a few race conditions.

parent f443f0d7
......@@ -64,22 +64,14 @@ has_only_unverified_consensus() {
wait_for_tor_consensus() {
log "Waiting for the Tor consensus file to contain a valid time interval"
while :; do
if has_consensus; then
break;
fi
while ! has_consensus; do
inotifywait -q -t ${INOTIFY_TIMEOUT} -e close_write -e moved_to --format %w%f ${TOR_DIR} || :
done
}
wait_for_working_tor() {
log "Waiting for Tor to be working (i.e. cached descriptors exist)"
while :; do
if tor_is_working; then
break;
fi
while ! tor_is_working; do
inotifywait -q -t ${INOTIFY_TIMEOUT} -e close_write -e moved_to --format %w%f ${TOR_DIR} || :
done
}
......
......@@ -10,10 +10,7 @@ while [ ! -d "$TORDATE_DIR" ]; do
done
# wait for a guarantee that time is in Tor valid range
while :; do
if [ -e "$TORDATE_DONE_FILE" ]; then
break
fi
while ! [ -e "$TORDATE_DONE_FILE" ]; do
inotifywait -q -t "$INOTIFY_TIMEOUT" -e create --format %w%f "$TORDATE_DIR"
done
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment