Commit 817e35ee authored by kytv's avatar kytv

Rework 'has bootstrapped' logic

Suggested by anonym -- thanks!
parent eb88da59
......@@ -40,6 +40,16 @@ i2p_reseed_completed() {
grep -q "Reseed complete" "${I2P_WRAPPER_LOG}"
}
i2p_reseed_status() {
if i2p_reseed_completed; then
echo success
elif i2p_reseed_failed; then
echo failure
elif i2p_reseed_started; then
echo running
fi
}
i2p_built_a_tunnel() {
netstat -nlp | grep -qwF "$(i2p_eep_proxy_address)"
}
......
......@@ -44,8 +44,8 @@ wait_until_i2p_router_console_is_ready() {
wait_until ${I2P_STARTUP_TIMEOUT} i2p_router_console_is_ready
}
i2p_fails_to_bootstrap() {
wait_until ${I2P_BOOTSTRAP_TIMEOUT} i2p_reseed_failed
wait_until_i2p_has_bootstrapped() {
wait_until ${I2P_BOOTSTRAP_TIMEOUT} '[ "$(i2p_reseed_status)" = success ]'
}
notify_router_console_success() {
......@@ -85,9 +85,7 @@ case "${1}" in
service i2p start
wait_until_i2p_router_console_is_ready || startup_failure
notify_router_console_success
if i2p_fails_to_bootstrap; then
bootstrap_failure
fi
wait_until_i2p_has_bootstrapped || bootstrap_failure
wait_until_i2p_builds_a_tunnel || bootstrap_failure
notify_bootstrap_success
;;
......
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