Commit cc2b70e7 authored by Tails developers's avatar Tails developers
Browse files

Fixed i2p start script so it depends on HTP success (workaround for i2p's

terrible clock skew/jump handling).
parent 9614cd92
......@@ -40,7 +40,7 @@ sub get_router_port {
# TODO: more perlish way to do below?
# TODO: use netstat -p, check that a child of i2psvc runs the router console
sub router_status {
return !system("netstat -nl -A inet,inet6 | grep -q -e \"\\(\\(127\\.0\\.0\\.1\\)\\|\\(::1\\)\\):" . get_router_port() . "\"");
return !system("netstat -nl -A inet,inet6 | grep -qe \"\\(127\\.0\\.0\\.1\\|::1\\):" . get_router_port() . "\"");
}
sub open_router_console {
......@@ -66,10 +66,34 @@ my $notification = $notify->create(summary => $summary,
body => $body,
timeout => 0);
start_i2psvc();
$notification->show();
my $htp_success_file = '/var/lib/live/htp-success';
my $htp_wait = 0;
# There was a "fix" in i2p 0.8.8 for handling clock jumps and skews which seems
# to be broken -- a jump during i2p bootstrap leads to i2p starting in a non-
# working state, as does starting i2p when the clock is off too much. Hence, for
# simplicity, we make i2p dependent on HTP succeeding. The real fix will be when
# i2p gets its act together and handles these problems correctly.
until (-e $htp_success_file) {
if ($htp_wait > 60) {
$notification->close();
$summary = gettext("I2P failed to start");
$body = gettext("Make sure that you have a working Internet " .
"connection, then try to start I2P again.");
$notification = $notify->create(summary => $summary,
body => $body,
timeout => 60000);
$notification->show();
exit 1;
}
sleep(1);
$htp_wait++;
}
start_i2psvc();
my $t = 0;
my $timeout = 180;
while ($t < $timeout && !router_status()) {
......@@ -84,10 +108,10 @@ if (router_status()) {
exit 0;
} else {
stop_i2psvc();
$summary = gettext("I2P failed to start");
$body = gettext("Something went wrong when I2P was starting. Look in the following file for more information:") . "\n\t/tmp/wrapper.log" . "\n\t/var/lib/i2p/.i2p/logs/log-router-*.txt";
$body = gettext("Something went wrong when I2P was starting. Look in " .
"the logs in the following directory for " .
"more information:") . "\n\t/var/log/i2p/";
$notification = $notify->create(summary => $summary,
body => $body,
timeout => 60000);
......
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