Re: [Tails-dev] Please review and merge bugfix/bridge_mode_…

このメッセージを削除

このメッセージに返信
著者: Ague Mill
日付:  
To: The Tails public development discussion list
題目: Re: [Tails-dev] Please review and merge bugfix/bridge_mode_vs_tor_restarts
anonym:
> anonym:
> > Here's a small post-freeze bugfix for Tails 0.15 which fixes the issue
> > with bridge mode + tordate discovered by ague. It's merged into
> > experimental.
> >
> > Branch: bugfix/bridge_mode_vs_tor_restarts
> > Ticket: https://tails.boum.org/todo/bridge_mode_vs_tor_restarts/
> >
> > commit 3f876314055b83f1aacd5ed790d03bad411a8aae
> > Author: Tails developers <amnesia@???>
> > Date: Thu Nov 15 16:56:26 2012 +0100
> >
> >     Create wrappers for (re)starting Tor and Vidalia.

> >
> >     If Vidalia is running, and Tor is restarted, then we also want to
> >     restart Vidalia. This is because Vidalia doesn't re-connect to Tor
> >     automatically, so the user has to restart it to be able to control Tor
> >     again. Also, any options set by Vidalia will be lost since they
> >     weren't written to torrc, which causes Tor to reach an inactive state
> >     if it's restarted in "bridge mode".


Quoting the diff:

> --- a/config/chroot_local-includes/usr/local/sbin/unsafe-browser
> +++ b/config/chroot_local-includes/usr/local/sbin/unsafe-browser
> @@ -203,15 +203,10 @@ maybe_restart_tor () {
>      # wheels turning)
>      if ! tor_is_working; then
>          echo "* Restarting Tor"
> -        if ! service tor restart; then
> +        restart-tor
> +        if ! service tor status >/dev/null; then
>              error "`gettext \"Failed to restart Tor.\"`"
>          fi
> -        local counter=0
> -        until [ "${counter}" -ge 10 ] || nc -z localhost 9051
>          2>/dev/null; do
> -            sleep 1
> -            counter=$((${counter}+1))
> -        done
> -        /etc/NetworkManager/dispatcher.d/60-vidalia.sh clearnet up
>          2>/dev/null
>      fi
>  }


This part makes me nervous. Previously there was a timer that would try
several time before displaying an error message. This change would mean
that tor needs to have its pid file ready really fast to prevent the
error message from being displayed…

I think keeping a small loop, or at least sleeping for a few seconds
would be better.

--
Ague