[tor-commits] [tor-browser-bundle/master] Bug 10077: Make binutils independent of mingw-w64.

2014-09-01 Thread gk
commit 5a3ca06d4d031019aadc0a50aa209a5ca86c2b3f
Author: Georg Koppen g...@torproject.org
Date:   Mon Sep 1 09:12:35 2014 +

Bug 10077: Make binutils independent of mingw-w64.

We might want to bump the binutils version independent of the mingw-w64
version. This does not work anymore if we don't at least touch a binutils
related file containing the currently built/used binutils version.
---
 gitian/descriptors/windows/gitian-utils.yml |2 ++
 gitian/mkbundle-windows.sh  |3 ++-
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/gitian/descriptors/windows/gitian-utils.yml 
b/gitian/descriptors/windows/gitian-utils.yml
index 2d0b3db..75e5662 100644
--- a/gitian/descriptors/windows/gitian-utils.yml
+++ b/gitian/descriptors/windows/gitian-utils.yml
@@ -152,6 +152,8 @@ script: |
 
   # Grabbing the remaining results
   cd $INSTDIR
+  # We might want to bump binutils independent of bumping mingw-w64.
+  touch binutils-$BINUTILS_VER-win32-utils.zip
   ~/build/dzip.sh mingw-w64-$GCC_VER-win32-utils.zip mingw-w64
   ~/build/dzip.sh zlib-${ZLIB_TAG#v}-win32-utils.zip zlib
   ~/build/dzip.sh libevent-${LIBEVENT_TAG#release-}-win32-utils.zip libevent
diff --git a/gitian/mkbundle-windows.sh b/gitian/mkbundle-windows.sh
index dfc326b..595ff29 100755
--- a/gitian/mkbundle-windows.sh
+++ b/gitian/mkbundle-windows.sh
@@ -96,7 +96,8 @@ fi
 
 cd $GITIAN_DIR
 
-if [ ! -f inputs/gcclibs-$GCC_VER-win32-utils.zip -o \
+if [ ! -f inputs/binutils-$BINUTILS_VER-win32-utils.zip -o \
+ ! -f inputs/gcclibs-$GCC_VER-win32-utils.zip -o \
  ! -f inputs/mingw-w64-$GCC_VER-win32-utils.zip -o \
  ! -f inputs/zlib-${ZLIB_TAG_ORIG#v}-win32-utils.zip -o \
  ! -f inputs/libevent-${LIBEVENT_TAG_ORIG#release-}-win32-utils.zip -o \

___
tor-commits mailing list
tor-commits@lists.torproject.org
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits


[tor-commits] [onionoo/master] Apply documentation tweaks by iwakeh.

2014-09-01 Thread karsten
commit a6abbbafe63da776fbf5445f01292b1c41df6fe8
Author: Karsten Loesing karsten.loes...@gmx.net
Date:   Sun Aug 31 19:27:36 2014 +0200

Apply documentation tweaks by iwakeh.

Implements #12934.
---
 HOWTO-VAGRANT.md |   43 +--
 INSTALL  |   17 +++--
 build.xml|3 ++-
 vagrant/bootstrap.sh |1 -
 4 files changed, 50 insertions(+), 14 deletions(-)

diff --git a/HOWTO-VAGRANT.md b/HOWTO-VAGRANT.md
index ae8783e..2cac164 100644
--- a/HOWTO-VAGRANT.md
+++ b/HOWTO-VAGRANT.md
@@ -1,7 +1,25 @@
 How to use Vagrant to build and test Onionoo
 
 
-Before using Vagrant, make sure that Onionoo builds correctly on the host 
system.  This may require running `git submodule init  git submodule update`, 
as well as providing all required libraries.
+Before using Vagrant, make sure that Onionoo builds correctly on the host
+system.
+This may require running `git submodule init  git submodule update`, as
+well as providing all required libraries.
+
+The given Vagrant file uses Version 2, i.e., a Vagrant installation
+of version 1.1 or above is necessary.
+The following was tested using 1.4.3 and VirtualBox 4.3.14.
+(Wheezy stable only provides 1.0.3, Jessie provides 1.4.3)
+
+Local changes to the Vagrantfile:
+Tell Vagrant how much memory the virtual machine may use, i.e., change
+
+```
+vb.memory = 4096
+```
+
+to some value that makes sense on your machine.
+Rule of thumb: less than half the RAM, but as much as you want to spare.
 
 Create a Debian Wheezy 64 bit instance:
 
@@ -9,17 +27,24 @@ Create a Debian Wheezy 64 bit instance:
 vagrant up
 ```
 
-This command downloads the virtual machine imagine, unless it has been 
downloaded before, creates a new virtual machine, and runs the bootstrap script 
in `vagrant/bootstrap.sh`.  This may take a few minutes.
+This command downloads the virtual machine imagine, unless it has been
+downloaded before, creates a new virtual machine, and runs the bootstrap
+script in `vagrant/bootstrap.sh`.  This may take a few minutes.
 
-Once this is all done, log into the virtual machine and change to the Onionoo 
working directory:
+Once this is all done, log into the virtual machine and change to the
+Onionoo working directory:
 
 ```
 vagrant ssh
 cd /srv/onionoo.torproject.org/onionoo/
 ```
 
-Important: better avoid runninng Ant in the `/vagrant/` directory (which is 
shared with the host), or the guest system will write directly to the host 
system, which performs not really well.
+Important: better avoid runninng Ant in the `/vagrant/` directory (which
+is shared with the host), or the guest system will write directly to the
+host system, which performs not really well.
 
+Read the INSTALL file and make the appropriate changes to adapt everything
+to your setup, e.g., memory settings.
 Compile Onionoo, run the unit tests and then the cron part of it:
 
 ```
@@ -28,7 +53,8 @@ ant test
 ant run
 ```
 
-This step may take an hour or more.  Onionoo downloads the last three days of 
Tor descriptors, which is about 2 GiB, and processes them.
+This step may take an hour or more.  Onionoo downloads the last three days
+of Tor descriptors, which is about 2 GiB, and processes them.
 
 Once these steps are done, deploy the servlet to the local Tomcat server:
 
@@ -36,7 +62,12 @@ Once these steps are done, deploy the servlet to the local 
Tomcat server:
 ant war
 ```
 
-Test the Onionoo service using a browser on the host (port 8080 on the guest 
is forwarded to the host).  Sample URL:
+Test the Onionoo service using a browser on the host (port 8080 on the guest
+is forwarded to the host).  Sample URL:
 
 http://localhost:8080/onionoo/summary?limit=2
 
+Note that Tomcat's default server.xml needs no changing for running in the
+development environment.
+See the INSTALL file for necessary changes in the production environment.
+
diff --git a/INSTALL b/INSTALL
index 58bbc41..2d73b78 100644
--- a/INSTALL
+++ b/INSTALL
@@ -11,7 +11,7 @@ $ git clone https://git.torproject.org/onionoo.git 
/srv/onionoo/
 $ cd /srv/onionoo
 
 
-Install Java 1.5 or higher, ant 1.8 or higher, and Tomcat 6
+Install Java 1.6 or higher, ant 1.8 or higher, and Tomcat 6
 ---
 
 $ javac -version
@@ -109,6 +109,9 @@ Test the hourly data processing process
 ---
 
 Run the data processing process that will afterwards be run once per hour.
+Currently, memory is set to 4G.  If you have more or less RAM to spare,
+change the value for the maxmemory.value property near the top of the
+build.xml file.
 The initial run may take a while:
 
 $ ant run
@@ -127,8 +130,10 @@ one:
 Configure Tomcat
 
 
-The following file may be a useful Tomcat configuration file.  Put it in
-/etc/tomcat6/server.xml:
+The following file may be a useful Tomcat configuration file.
+Make changes according to your 

[tor-commits] [translation/tails-iuk_completed] Update translations for tails-iuk_completed

2014-09-01 Thread translation
commit 67b290973ba2c93890697cffb192a45b6fd298e6
Author: Translation commit bot translat...@torproject.org
Date:   Mon Sep 1 09:47:33 2014 +

Update translations for tails-iuk_completed
---
 pt.po |   79 ++---
 pt_BR.po  |   74 -
 tails-iuk.pot |   76 --
 3 files changed, 121 insertions(+), 108 deletions(-)

diff --git a/pt.po b/pt.po
index a0ee256..0a213ae 100644
--- a/pt.po
+++ b/pt.po
@@ -3,15 +3,16 @@
 # This file is distributed under the same license as the PACKAGE package.
 # 
 # Translators:
-# alfalb_mansil manuela.si...@sky.com, 2014
+# Manuela Silva manuela.si...@sky.com, 2014
 # André Monteiro andre.mont...@gmail.com, 2014
+# Pedro Albuquerque palbuquerqu...@gmail.com, 2014
 msgid 
 msgstr 
 Project-Id-Version: The Tor Project\n
 Report-Msgid-Bugs-To: Tails developers ta...@boum.org\n
-POT-Creation-Date: 2014-03-05 15:11+0100\n
-PO-Revision-Date: 2014-03-14 12:40+\n
-Last-Translator: André Monteiro andre.mont...@gmail.com\n
+POT-Creation-Date: 2014-08-31 15:23+0200\n
+PO-Revision-Date: 2014-09-01 09:30+\n
+Last-Translator: Pedro Albuquerque palbuquerqu...@gmail.com\n
 Language-Team: Portuguese 
(http://www.transifex.com/projects/p/torproject/language/pt/)\n
 MIME-Version: 1.0\n
 Content-Type: text/plain; charset=UTF-8\n
@@ -19,8 +20,8 @@ msgstr 
 Language: pt\n
 Plural-Forms: nplurals=2; plural=(n != 1);\n
 
-#: ../lib/Tails/IUK/Frontend.pm:146 ../lib/Tails/IUK/Frontend.pm:523
-#: ../lib/Tails/IUK/Frontend.pm:667
+#: ../lib/Tails/IUK/Frontend.pm:146 ../lib/Tails/IUK/Frontend.pm:527
+#: ../lib/Tails/IUK/Frontend.pm:671
 msgid For debugging information, see /home/amnesia/.xsession-errors
 msgstr Para informação de depuração, ver /home/amnesia/.xsession-erros
 
@@ -62,39 +63,43 @@ msgstr não existe memória suficiente neste sistema
 msgid No explanation available for reason '%{reason}s'.
 msgstr Sem explicação disponível para o erro '%{reason}s'.
 
-#: ../lib/Tails/IUK/Frontend.pm:281
+#: ../lib/Tails/IUK/Frontend.pm:279
+msgid XXX HEJ XXX
+msgstr XXX HEJ XXX
+
+#: ../lib/Tails/IUK/Frontend.pm:285
 msgid The system is up-to-date
 msgstr O sistema está atualizado
 
-#: ../lib/Tails/IUK/Frontend.pm:286
+#: ../lib/Tails/IUK/Frontend.pm:290
 msgid This version of Tails is outdated, and may have security issues.
 msgstr Esta versão de Tails está desatualizada, podem haver problemas de 
segurança.
 
-#: ../lib/Tails/IUK/Frontend.pm:318
+#: ../lib/Tails/IUK/Frontend.pm:322
 #, perl-brace-format
 msgid 
 The available incremental upgrade requires %{space_needed}s of free space on
  Tails system partition,  but only %{free_space}s is available.
 msgstr A atualização disponível requer %{space_needed}s de espaço livre 
na partição de sistema Tails,  mas apenas %{free_space}s está disponível.
 
-#: ../lib/Tails/IUK/Frontend.pm:334
+#: ../lib/Tails/IUK/Frontend.pm:338
 #, perl-brace-format
 msgid 
 The available incremental upgrade requires %{memory_needed}s of free memory,
  but only %{free_memory}s is available.
 msgstr A atualização disponível requer %{memory_needed}s of free memory, 
mas apenas %{free_memory}s está disponível.
 
-#: ../lib/Tails/IUK/Frontend.pm:356
+#: ../lib/Tails/IUK/Frontend.pm:360
 msgid 
 An incremental upgrade is available, but no full upgrade is.\n
 This should not happen. Please report a bug.
 msgstr Uma atualização incremental está disponível, mas a total 
não.\nIsto não devia suceder. Por favor reporte o erro.
 
-#: ../lib/Tails/IUK/Frontend.pm:360
+#: ../lib/Tails/IUK/Frontend.pm:364
 msgid Error while detecting available upgrades
 msgstr Erro na deteção de atualizações disponíveis
 
-#: ../lib/Tails/IUK/Frontend.pm:370
+#: ../lib/Tails/IUK/Frontend.pm:374
 #, perl-brace-format
 msgid 
 bYou should upgrade to %{name}s %{version}s./b\n
@@ -110,19 +115,19 @@ msgid 
 Do you want to upgrade now?
 msgstr bDeve atualizar para %{name}s %{version}s./b\n\nPara mais 
informação acerca desta nova versão vá a %{details_url}s\n\nÉ recomendado 
que feche todas as aplicações abertas durante a atualização.\nA 
transferência da atualização pode demorar algum tempo, desde alguns minutos 
até algumas horas.\nA rede será desativada após o término da transferência 
da atualização.\n\nTamanho da transferência: %{size}s\n\nDeseja atualizar 
agora?
 
-#: ../lib/Tails/IUK/Frontend.pm:385
+#: ../lib/Tails/IUK/Frontend.pm:389
 msgid Upgrade available
 msgstr Atualização disponível
 
-#: ../lib/Tails/IUK/Frontend.pm:386
+#: ../lib/Tails/IUK/Frontend.pm:390
 msgid Upgrade now
 msgstr Atualize agora
 
-#: ../lib/Tails/IUK/Frontend.pm:387
+#: ../lib/Tails/IUK/Frontend.pm:391
 msgid Upgrade later
 msgstr Atualize mais tarde
 
-#: ../lib/Tails/IUK/Frontend.pm:395
+#: ../lib/Tails/IUK/Frontend.pm:399
 #, perl-brace-format
 msgid 
 bYou should do a manual upgrade to 

[tor-commits] [oonib/master] Implement unittests for HTTP test helpers.

2014-09-01 Thread art
commit 5ee55d4d69a1ac846ebb5f57bbc0a938b113b202
Author: Arturo Filastò a...@fuffa.org
Date:   Fri Aug 29 13:09:01 2014 +0200

Implement unittests for HTTP test helpers.

Fix some bugs found in unittesting.
---
 oonib/test/handler_helpers.py |5 +++--
 oonib/test/test_testhelpers.py|   28 
 oonib/testhelpers/__init__.py |5 -
 oonib/testhelpers/http_helpers.py |   12 ++--
 4 files changed, 41 insertions(+), 9 deletions(-)

diff --git a/oonib/test/handler_helpers.py b/oonib/test/handler_helpers.py
index 4e9905d..06beb6d 100644
--- a/oonib/test/handler_helpers.py
+++ b/oonib/test/handler_helpers.py
@@ -79,11 +79,12 @@ class HandlerTestCase(unittest.TestCase):
 self._listener.stopListening()
 
 @defer.inlineCallbacks
-def request(self, path, method=GET, postdata=None):
+def request(self, path, method=GET, postdata=None, headers={}):
 url = http://localhost:%s%s; % (self.port, path)
 if isinstance(postdata, dict):
 postdata = json.dumps(postdata)
 
 response = yield httpclient.fetch(url, method=method,
-  postdata=postdata)
+  postdata=postdata,
+  headers=headers)
 defer.returnValue(response)
diff --git a/oonib/test/test_testhelpers.py b/oonib/test/test_testhelpers.py
new file mode 100644
index 000..1f1a5da
--- /dev/null
+++ b/oonib/test/test_testhelpers.py
@@ -0,0 +1,28 @@
+import json
+from twisted.internet import defer
+
+from oonib.test.handler_helpers import HandlerTestCase
+from oonib.testhelpers import http_helpers
+
+
+class TestHTTPReturnJSONHeaders(HandlerTestCase):
+app = http_helpers.HTTPReturnJSONHeadersHelper()
+
+@defer.inlineCallbacks
+def test_get_request(self):
+response = yield self.request('/', GET,
+  headers={'X-Antani': ['Spam']})
+response_body = json.loads(response.body)
+self.assertIn(headers_dict, response_body)
+self.assertIn(X-Antani, response_body['headers_dict'])
+self.assertIn([X-Antani, Spam], response_body['request_headers'])
+self.assertEqual(GET / HTTP/1.1, response_body['request_line'])
+
+
+class TestHTTPRandomPage(HandlerTestCase):
+app = http_helpers.HTTPRandomPageHelper
+
+@defer.inlineCallbacks
+def test_get_request(self):
+response = yield self.request('/100/ham', GET)
+self.assertEqual(len(response.body), 104)
diff --git a/oonib/testhelpers/__init__.py b/oonib/testhelpers/__init__.py
index 3a0e438..e43a702 100644
--- a/oonib/testhelpers/__init__.py
+++ b/oonib/testhelpers/__init__.py
@@ -1,6 +1 @@
-from . import dns_helpers
-from . import http_helpers
-from . import ssl_helpers
-from . import tcp_helpers
-
 __all__ = ['dns_helpers', 'http_helpers', 'ssl_helpers', 'tcp_helpers']
diff --git a/oonib/testhelpers/http_helpers.py 
b/oonib/testhelpers/http_helpers.py
index 8e03164..a28cbad 100644
--- a/oonib/testhelpers/http_helpers.py
+++ b/oonib/testhelpers/http_helpers.py
@@ -85,7 +85,7 @@ class SimpleHTTPChannel(basic.LineReceiver, 
policies.TimeoutMixin):
 
 if len(self.headers) = self.maxHeaders:
 log.err(Maximum number of headers received.)
-return self.transport.loseConnection()
+self.closeConnection()
 
 def allHeadersReceived(self):
 headers_dict = {}
@@ -102,6 +102,14 @@ class SimpleHTTPChannel(basic.LineReceiver, 
policies.TimeoutMixin):
 json_response = json.dumps(response)
 self.transport.write('HTTP/1.1 200 OK\r\n\r\n')
 self.transport.write('%s' % json_response)
+
+self.closeConnection()
+
+def closeConnection(self):
+if self._TimeoutMixin__timeoutCall and \
+not self._TimeoutMixin__timeoutCall.called:
+self._TimeoutMixin__timeoutCall.cancel()
+self._TimeoutMixin__timeoutCall = None
 self.transport.loseConnection()
 
 
@@ -158,7 +166,7 @@ class HTTPRandomPage(HTTPTrapAll):
 length = 100
 if length  10:
 length = 10
-return self.genRandomPage(length, keyword)
+self.write(self.genRandomPage(length, keyword))
 
 HTTPRandomPageHelper = Application([
 # XXX add regexps here

___
tor-commits mailing list
tor-commits@lists.torproject.org
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits


[tor-commits] [oonib/master] Add coveragerc

2014-09-01 Thread art
commit fdd73bfab661e366df6f0fdc29a9a3aa6261d88d
Author: Arturo Filastò a...@fuffa.org
Date:   Fri Aug 29 12:08:45 2014 +0200

Add coveragerc
---
 .coveragerc |2 ++
 1 file changed, 2 insertions(+)

diff --git a/.coveragerc b/.coveragerc
new file mode 100644
index 000..e77b5ca
--- /dev/null
+++ b/.coveragerc
@@ -0,0 +1,2 @@
+[run]
+source = oonib



___
tor-commits mailing list
tor-commits@lists.torproject.org
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits


[tor-commits] [oonib/master] Add synonym for http_requests_test

2014-09-01 Thread art
commit b0fa6d681a9a858432109ed12ee47da3483e78c8
Author: Arturo Filastò a...@fuffa.org
Date:   Mon Sep 1 12:30:40 2014 +0200

Add synonym for http_requests_test
---
 data/bouncer.yaml |1 +
 1 file changed, 1 insertion(+)

diff --git a/data/bouncer.yaml b/data/bouncer.yaml
index eb30cc9..6ef6b71 100644
--- a/data/bouncer.yaml
+++ b/data/bouncer.yaml
@@ -7,6 +7,7 @@ collector:
   nettest:
   - {name: dns_consistency, version: '0.5'}
   - {name: http_requests_test, version: 0.2.3}
+  - {name: http_requests, version: 0.2.3}
   - {name: tcp_connect, version: '0.1'}
   - {name: captiveportal, version: '0.2'}
   - {name: daphn3, version: '0.1'}

___
tor-commits mailing list
tor-commits@lists.torproject.org
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits


[tor-commits] [oonib/master] Improved RESTfulness of the bouncer API.

2014-09-01 Thread art
commit fce1c169401ed3ec110c82eaeeade14f4aab8151
Author: kudrom kud...@riseup.net
Date:   Fri Aug 29 18:43:14 2014 +0200

Improved RESTfulness of the bouncer API.
---
 oonib/bouncer/api.py   |8 +++--
 oonib/bouncer/handlers.py  |   46 
 oonib/test/test_bouncer.py |   71 +---
 3 files changed, 99 insertions(+), 26 deletions(-)

diff --git a/oonib/bouncer/api.py b/oonib/bouncer/api.py
index 42f53e1..666c708 100644
--- a/oonib/bouncer/api.py
+++ b/oonib/bouncer/api.py
@@ -1,6 +1,8 @@
 from oonib.bouncer import handlers
-#XXX: if bouncer is configured
+# XXX: if bouncer is configured
 bouncerAPI = [
-#return a collector and helper of the requested type
-(r/bouncer, handlers.BouncerQueryHandler),
+# return a collector and helper of the requested type
+(r/bouncer, handlers.BouncerQueryHandler),
+(r/bouncer/test-helpers, handlers.BouncerTestHelpers),
+(r/bouncer/net-tests, handlers.BouncerNetTests),
 ]
diff --git a/oonib/bouncer/handlers.py b/oonib/bouncer/handlers.py
index c49338e..c7914b5 100644
--- a/oonib/bouncer/handlers.py
+++ b/oonib/bouncer/handlers.py
@@ -165,27 +165,49 @@ class Bouncer(object):
 return {'net-tests': nettests}
 
 
-class BouncerQueryHandler(OONIBHandler):
-
+class BouncerHandlerBase(OONIBHandler):
 def initialize(self):
 self.bouncer = Bouncer(config.main.bouncer_file)
 
-def post(self):
-try:
-query = json.loads(self.request.body)
-except ValueError:
-raise e.InvalidRequest
+def load_query(self):
+if not 'query' in dir(self):
+try:
+self.query = json.loads(self.request.body)
+except ValueError:
+raise e.InvalidRequest
+
 
-if 'test-helpers' in query:
-requested_helpers = query['test-helpers']
+class BouncerTestHelpers(BouncerHandlerBase):
+def post(self):
+self.load_query()
+if 'test-helpers' in self.query:
+requested_helpers = self.query['test-helpers']
 if not isinstance(requested_helpers, list):
 raise e.InvalidRequest
 response = self.bouncer.filterHelperAddresses(requested_helpers)
+else:
+raise e.InvalidRequest
+
+self.write(response)
 
-elif 'net-tests' in query:
-response = self.bouncer.filterByNetTests(query['net-tests'])
 
+class BouncerNetTests(BouncerHandlerBase):
+def post(self):
+self.load_query()
+if 'net-tests' in self.query:
+response = self.bouncer.filterByNetTests(self.query['net-tests'])
 else:
-raise e.TestHelpersOrNetTestsKeyMissing
+raise e.InvalidRequest
 
 self.write(response)
+
+
+class BouncerQueryHandler(BouncerNetTests, BouncerTestHelpers):
+def post(self):
+self.load_query()
+if 'test-helpers' in self.query:
+BouncerTestHelpers.post(self)
+elif 'net-tests' in self.query:
+BouncerNetTests.post(self)
+else:
+raise e.TestHelpersOrNetTestsKeyMissing
diff --git a/oonib/test/test_bouncer.py b/oonib/test/test_bouncer.py
index 2724947..0f4c5ef 100644
--- a/oonib/test/test_bouncer.py
+++ b/oonib/test/test_bouncer.py
@@ -125,7 +125,7 @@ class TestBouncer(BaseTestBouncer):
 ]
 }
 
-response = yield self.request('/bouncer', 'POST', data)
+response = yield self.request('/bouncer/net-tests', 'POST', data)
 response_body = json.loads(response.body)
 
 self.assertIn('error', response_body)
@@ -144,6 +144,35 @@ class TestBouncer(BaseTestBouncer):
 ]
 }
 
+response = yield self.request('/bouncer/net-tests', 'POST', data)
+response_body = json.loads(response.body)
+
+self.assertIn('net-tests', response_body)
+self.assertEqual(len(response_body['net-tests']), 1)
+self.assertIn('name', response_body['net-tests'][0])
+self.assertEqual(response_body['net-tests'][0]['name'], 'fake_nettest')
+self.assertIn('version', response_body['net-tests'][0])
+self.assertEqual(response_body['net-tests'][0]['version'], '1.0')
+self.assertIn('input-hashes', response_body['net-tests'][0])
+self.assertEqual(len(response_body['net-tests'][0]['input-hashes']), 0)
+self.assertIn('test-helpers', response_body['net-tests'][0])
+self.assertEqual(len(response_body['net-tests'][0]['test-helpers']), 0)
+self.assertIn('collector', response_body['net-tests'][0])
+self.assertEqual(response_body['net-tests'][0]['collector'], 
'fake_address')
+
+@defer.inlineCallbacks
+def test_backward_compatibility(self):
+data = {
+'net-tests': [
+{
+test-helpers: [],
+input-hashes: [],
+name: 'fake_nettest',
+   

[tor-commits] [ooni-probe/master] Implement policy aware bouncing support in the client

2014-09-01 Thread art
commit 9220c796dafcc850af42bcba6906ae49afa19edc
Author: kudrom kud...@riseup.net
Date:   Sun Aug 24 23:15:18 2014 +0200

Implement policy aware bouncing support in the client
---
 ooni/deck.py|   86 ---
 ooni/oonibclient.py |4 +--
 2 files changed, 77 insertions(+), 13 deletions(-)

diff --git a/ooni/deck.py b/ooni/deck.py
index 889e17e..22ff0d5 100644
--- a/ooni/deck.py
+++ b/ooni/deck.py
@@ -1,4 +1,4 @@
-#-*- coding: utf-8 -*-
+# -*- coding: utf-8 -*-
 
 from ooni.oonibclient import OONIBClient
 from ooni.nettest import NetTestLoader
@@ -14,6 +14,7 @@ import yaml
 import json
 from hashlib import sha256
 
+
 class InputFile(object):
 def __init__(self, input_hash, base_path=config.inputs_directory):
 self.id = input_hash
@@ -44,13 +45,13 @@ class InputFile(object):
 def save(self):
 with open(self.cached_descriptor, 'w+') as f:
 json.dump({
-'name': self.name,
-'id': self.id,
-'version': self.version,
-'author': self.author,
-'date': self.date,
-'description': self.description
-}, f)
+  'name': self.name,
+  'id': self.id,
+  'version': self.version,
+  'author': self.author,
+  'date': self.date,
+  'description': self.description
+  }, f)
 
 def load(self, descriptor):
 self.name = descriptor['name']
@@ -65,6 +66,7 @@ class InputFile(object):
 file_hash = sha256(f.read())
 assert file_hash.hexdigest() == digest
 
+
 def nettest_to_path(path, allow_arbitrary_paths=False):
 
 Takes as input either a path or a nettest name.
@@ -87,6 +89,7 @@ def nettest_to_path(path, allow_arbitrary_paths=False):
 else:
 raise e.NetTestNotFound(path)
 
+
 class Deck(InputFile):
 def __init__(self, deck_hash=None,
  deckFile=None,
@@ -135,11 +138,13 @@ class Deck(InputFile):
 
 def insert(self, net_test_loader):
  Add a NetTestLoader to this test deck 
+
 def has_test_helper(missing_option):
 for rth in net_test_loader.requiredTestHelpers:
 if missing_option == rth['option']:
 return True
 return False
+
 try:
 net_test_loader.checkOptions()
 if net_test_loader.requiresTor:
@@ -161,8 +166,67 @@ class Deck(InputFile):
 yield self.fetchAndVerifyNetTestInput(net_test_loader)
 
 if self.bouncer:
-log.msg(Looking up test helpers...)
-yield self.lookupTestHelpers()
+log.msg(Looking up collector and test helpers)
+yield self.lookupCollector()
+
+@defer.inlineCallbacks
+def lookupCollector(self):
+self.oonibclient.address = self.bouncer
+
+required_nettests = []
+
+requires_test_helpers = False
+requires_collector = False
+for net_test_loader in self.netTestLoaders:
+nettest = {
+'name': net_test_loader.testDetails['test_name'],
+'version': net_test_loader.testDetails['test_version'],
+'test-helpers': [],
+'input-hashes': [x['hash'] for x in net_test_loader.inputFiles]
+}
+if not net_test_loader.collector:
+requires_collector = True
+
+for th in net_test_loader.requiredTestHelpers:
+# {'name':'', 'option':'', 'test_class':''}
+if th['test_class'].localOptions[th['option']]:
+continue
+nettest['test-helpers'].append(th['name'])
+requires_test_helpers = True
+
+required_nettests.append(nettest)
+
+if not requires_test_helpers and not requires_collector:
+defer.returnValue(None)
+
+response = yield 
self.oonibclient.lookupTestCollector(required_nettests)
+print response
+provided_net_tests = response['net-tests']
+
+def find_collector_and_test_helpers(test_name, test_version, 
input_files):
+for net_test in provided_net_tests:
+if net_test['name'] != test_name:
+continue
+if net_test['version'] != test_version:
+continue
+if set(net_test['input-hashes']) != set(input_files):
+continue
+return net_test['collector'], net_test['test-helpers']
+
+for net_test_loader in self.netTestLoaders:
+log.msg(Setting collector and test helpers for %s % 
net_test_loader.testDetails['test_name'])
+
+collector, test_helpers = \
+
find_collector_and_test_helpers(net_test_loader.testDetails['test_name'],
+  

[tor-commits] [ooni-probe/master] pep8 cleanup

2014-09-01 Thread art
commit f217bca743a6f4ed150c7179df6e00fdb48efa5d
Author: kudrom kud...@riseup.net
Date:   Mon Aug 25 15:36:38 2014 +0200

pep8 cleanup
---
 ooni/deck.py|1 -
 ooni/oonibclient.py |   18 --
 2 files changed, 12 insertions(+), 7 deletions(-)

diff --git a/ooni/deck.py b/ooni/deck.py
index 22ff0d5..f77bfa6 100644
--- a/ooni/deck.py
+++ b/ooni/deck.py
@@ -200,7 +200,6 @@ class Deck(InputFile):
 defer.returnValue(None)
 
 response = yield 
self.oonibclient.lookupTestCollector(required_nettests)
-print response
 provided_net_tests = response['net-tests']
 
 def find_collector_and_test_helpers(test_name, test_version, 
input_files):
diff --git a/ooni/oonibclient.py b/ooni/oonibclient.py
index 9871944..3d2e1b1 100644
--- a/ooni/oonibclient.py
+++ b/ooni/oonibclient.py
@@ -22,8 +22,8 @@ class OONIBClient(object):
 if self.address.startswith('httpo://'):
 address = self.address.replace('httpo://', 'http://')
 agent = TrueHeadersSOCKS5Agent(reactor,
-proxyEndpoint=TCP4ClientEndpoint(reactor, '127.0.0.1',
-config.tor.socks_port))
+   
proxyEndpoint=TCP4ClientEndpoint(reactor, '127.0.0.1',
+
config.tor.socks_port))
 
 elif self.address.startswith('https://'):
 log.err(HTTPS based bouncers are currently not supported.)
@@ -59,6 +59,7 @@ class OONIBClient(object):
 else:
 log.err(Failed. Giving up.)
 finished.errback(err)
+
 d.addErrback(errback, attempts)
 
 perform_request(attempts)
@@ -84,6 +85,7 @@ class OONIBClient(object):
 log.err(Got this backend error message %s % response)
 raise e.get_error(response['error'])
 return response
+
 return BodyReceiver(finished, content_length, process_response)
 
 return self._request(method, urn, genReceiver, bodyProducer)
@@ -97,6 +99,7 @@ class OONIBClient(object):
 
 def getInput(self, input_hash):
 from ooni.deck import InputFile
+
 input_file = InputFile(input_hash)
 if input_file.descriptorCached:
 return defer.succeed(input_file)
@@ -121,12 +124,13 @@ class OONIBClient(object):
 
 def downloadInput(self, input_hash):
 from ooni.deck import InputFile
+
 input_file = InputFile(input_hash)
 
 if input_file.fileCached:
 return defer.succeed(input_file)
 else:
-d = self.download('/input/'+input_hash+'/file', 
input_file.cached_file)
+d = self.download('/input/' + input_hash + '/file', 
input_file.cached_file)
 
 @d.addCallback
 def cb(res):
@@ -151,6 +155,7 @@ class OONIBClient(object):
 
 def getDeck(self, deck_hash):
 from ooni.deck import Deck
+
 deck = Deck(deck_hash)
 if deck.descriptorCached:
 return defer.succeed(deck)
@@ -173,11 +178,12 @@ class OONIBClient(object):
 
 def downloadDeck(self, deck_hash):
 from ooni.deck import Deck
+
 deck = Deck(deck_hash)
 if deck.fileCached:
 return defer.succeed(deck)
 else:
-d = self.download('/deck/'+deck_hash+'/file', deck.cached_file)
+d = self.download('/deck/' + deck_hash + '/file', deck.cached_file)
 
 @d.addCallback
 def cb(res):
@@ -196,7 +202,7 @@ class OONIBClient(object):
 def lookupTestCollector(self, net_tests):
 try:
 test_collector = yield self.queryBackend('POST', '/bouncer',
-query={'net-tests': net_tests})
+ query={'net-tests': 
net_tests})
 except Exception:
 raise e.CouldNotFindTestCollector
 
@@ -206,7 +212,7 @@ class OONIBClient(object):
 def lookupTestHelpers(self, test_helper_names):
 try:
 test_helper = yield self.queryBackend('POST', '/bouncer',
-query={'test-helpers': test_helper_names})
+  query={'test-helpers': 
test_helper_names})
 except Exception as exc:
 log.exception(exc)
 raise e.CouldNotFindTestHelper



___
tor-commits mailing list
tor-commits@lists.torproject.org
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits


[tor-commits] [ooni-probe/master] Review of policy aware changes in the client

2014-09-01 Thread art
commit 6b20b7fe62a42a6f3bab68cba25bf923f822f8b6
Author: kudrom kud...@riseup.net
Date:   Mon Aug 25 23:11:29 2014 +0200

Review of policy aware changes in the client
---
 Vagrantfile  |2 +-
 ooni/deck.py |2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/Vagrantfile b/Vagrantfile
index bd9d5db..4f9bc9b 100644
--- a/Vagrantfile
+++ b/Vagrantfile
@@ -10,7 +10,7 @@ Vagrant.configure(2) do |config|
 
   config.vm.synced_folder ., /ooni
   # Place the ooni-backend source code in ../ooni-backend to sync it with the 
vagrant instance
-  config.vm.synced_folder ../ooni-backend, /oonib
+  config.vm.synced_folder ../ooni-backend, /backend
 
 end
 
diff --git a/ooni/deck.py b/ooni/deck.py
index f77bfa6..6ea6740 100644
--- a/ooni/deck.py
+++ b/ooni/deck.py
@@ -184,7 +184,7 @@ class Deck(InputFile):
 'test-helpers': [],
 'input-hashes': [x['hash'] for x in net_test_loader.inputFiles]
 }
-if not net_test_loader.collector:
+if not net_test_loader.collector and not self.no_collector:
 requires_collector = True
 
 for th in net_test_loader.requiredTestHelpers:



___
tor-commits mailing list
tor-commits@lists.torproject.org
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits


[tor-commits] [ooni-probe/master] Improved RESTfulness of the bouncer API.

2014-09-01 Thread art
commit 745039c45ba3f10ed7a63cc36d7f223d4c14bceb
Author: kudrom kud...@riseup.net
Date:   Fri Aug 29 18:43:14 2014 +0200

Improved RESTfulness of the bouncer API.
---
 ooni/oonibclient.py |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/ooni/oonibclient.py b/ooni/oonibclient.py
index 3d2e1b1..a26b771 100644
--- a/ooni/oonibclient.py
+++ b/ooni/oonibclient.py
@@ -201,7 +201,7 @@ class OONIBClient(object):
 @defer.inlineCallbacks
 def lookupTestCollector(self, net_tests):
 try:
-test_collector = yield self.queryBackend('POST', '/bouncer',
+test_collector = yield self.queryBackend('POST', 
'/bouncer/net-tests',
  query={'net-tests': 
net_tests})
 except Exception:
 raise e.CouldNotFindTestCollector
@@ -211,7 +211,7 @@ class OONIBClient(object):
 @defer.inlineCallbacks
 def lookupTestHelpers(self, test_helper_names):
 try:
-test_helper = yield self.queryBackend('POST', '/bouncer',
+test_helper = yield self.queryBackend('POST', 
'/bouncer/test-helpers',
   query={'test-helpers': 
test_helper_names})
 except Exception as exc:
 log.exception(exc)



___
tor-commits mailing list
tor-commits@lists.torproject.org
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits


[tor-commits] [ooni-probe/master] Fix bug in checking for the correct input hash.

2014-09-01 Thread art
commit 8c56b166ca5639e75bc2eeb6f54cd7bfd253481f
Author: Arturo Filastò a...@fuffa.org
Date:   Mon Sep 1 12:29:29 2014 +0200

Fix bug in checking for the correct input hash.
---
 ooni/deck.py |1 +
 1 file changed, 1 insertion(+)

diff --git a/ooni/deck.py b/ooni/deck.py
index 6ea6740..d01378c 100644
--- a/ooni/deck.py
+++ b/ooni/deck.py
@@ -203,6 +203,7 @@ class Deck(InputFile):
 provided_net_tests = response['net-tests']
 
 def find_collector_and_test_helpers(test_name, test_version, 
input_files):
+input_files = [u+x['hash'] for x in input_files]
 for net_test in provided_net_tests:
 if net_test['name'] != test_name:
 continue

___
tor-commits mailing list
tor-commits@lists.torproject.org
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits


[tor-commits] [translation/tails-iuk] Update translations for tails-iuk

2014-09-01 Thread translation
commit ccb1f8804ed593f525300144eb59c98439c3af97
Author: Translation commit bot translat...@torproject.org
Date:   Mon Sep 1 12:45:45 2014 +

Update translations for tails-iuk
---
 fr_CA.po |6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/fr_CA.po b/fr_CA.po
index 36f3ae4..6677b8c 100644
--- a/fr_CA.po
+++ b/fr_CA.po
@@ -11,8 +11,8 @@ msgstr 
 Project-Id-Version: The Tor Project\n
 Report-Msgid-Bugs-To: Tails developers ta...@boum.org\n
 POT-Creation-Date: 2014-08-31 15:23+0200\n
-PO-Revision-Date: 2014-09-01 09:20+\n
-Last-Translator: runasand runa.sand...@gmail.com\n
+PO-Revision-Date: 2014-09-01 12:40+\n
+Last-Translator: yahoe.001\n
 Language-Team: French (Canada) 
(http://www.transifex.com/projects/p/torproject/language/fr_CA/)\n
 MIME-Version: 1.0\n
 Content-Type: text/plain; charset=UTF-8\n
@@ -65,7 +65,7 @@ msgstr Aucune explication disponible pour la raison « 
%{reason}s ».
 
 #: ../lib/Tails/IUK/Frontend.pm:279
 msgid XXX HEJ XXX
-msgstr 
+msgstr XXX HEJ XXX
 
 #: ../lib/Tails/IUK/Frontend.pm:285
 msgid The system is up-to-date

___
tor-commits mailing list
tor-commits@lists.torproject.org
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits


[tor-commits] [translation/tails-iuk_completed] Update translations for tails-iuk_completed

2014-09-01 Thread translation
commit a1c79aa50feab12be367ddf1a812b89f0baaa662
Author: Translation commit bot translat...@torproject.org
Date:   Mon Sep 1 12:45:49 2014 +

Update translations for tails-iuk_completed
---
 fr_CA.po |   78 +-
 1 file changed, 41 insertions(+), 37 deletions(-)

diff --git a/fr_CA.po b/fr_CA.po
index df760b3..6677b8c 100644
--- a/fr_CA.po
+++ b/fr_CA.po
@@ -5,14 +5,14 @@
 # Translators:
 # bassmax, 2013
 # Towatowa441, 2013
-# Alain-Olivier  Breysse, 2014
+# yahoe.001, 2014
 msgid 
 msgstr 
 Project-Id-Version: The Tor Project\n
 Report-Msgid-Bugs-To: Tails developers ta...@boum.org\n
-POT-Creation-Date: 2014-03-05 15:11+0100\n
-PO-Revision-Date: 2014-03-06 12:50+\n
-Last-Translator: Alain-Olivier  Breysse\n
+POT-Creation-Date: 2014-08-31 15:23+0200\n
+PO-Revision-Date: 2014-09-01 12:40+\n
+Last-Translator: yahoe.001\n
 Language-Team: French (Canada) 
(http://www.transifex.com/projects/p/torproject/language/fr_CA/)\n
 MIME-Version: 1.0\n
 Content-Type: text/plain; charset=UTF-8\n
@@ -20,8 +20,8 @@ msgstr 
 Language: fr_CA\n
 Plural-Forms: nplurals=2; plural=(n  1);\n
 
-#: ../lib/Tails/IUK/Frontend.pm:146 ../lib/Tails/IUK/Frontend.pm:523
-#: ../lib/Tails/IUK/Frontend.pm:667
+#: ../lib/Tails/IUK/Frontend.pm:146 ../lib/Tails/IUK/Frontend.pm:527
+#: ../lib/Tails/IUK/Frontend.pm:671
 msgid For debugging information, see /home/amnesia/.xsession-errors
 msgstr Pour les informations de débogage, voir 
/home/amnesia/.xsession-errors
 
@@ -63,39 +63,43 @@ msgstr il n'y a pas assez de mémoire disponible sur ce 
système
 msgid No explanation available for reason '%{reason}s'.
 msgstr Aucune explication disponible pour la raison « %{reason}s ».
 
-#: ../lib/Tails/IUK/Frontend.pm:281
+#: ../lib/Tails/IUK/Frontend.pm:279
+msgid XXX HEJ XXX
+msgstr XXX HEJ XXX
+
+#: ../lib/Tails/IUK/Frontend.pm:285
 msgid The system is up-to-date
 msgstr Le système est à jour
 
-#: ../lib/Tails/IUK/Frontend.pm:286
+#: ../lib/Tails/IUK/Frontend.pm:290
 msgid This version of Tails is outdated, and may have security issues.
 msgstr Cette version de Tails est obsolète et peut avoir des problèmes de 
sécurité.
 
-#: ../lib/Tails/IUK/Frontend.pm:318
+#: ../lib/Tails/IUK/Frontend.pm:322
 #, perl-brace-format
 msgid 
 The available incremental upgrade requires %{space_needed}s of free space on
  Tails system partition,  but only %{free_space}s is available.
 msgstr La mise à niveau incrémentale disponible exige %{space_needed}s 
d'espace libre sur la partition système de Tails, mais seulement 
%{free_space}s est libre.
 
-#: ../lib/Tails/IUK/Frontend.pm:334
+#: ../lib/Tails/IUK/Frontend.pm:338
 #, perl-brace-format
 msgid 
 The available incremental upgrade requires %{memory_needed}s of free memory,
  but only %{free_memory}s is available.
 msgstr La mise à niveau incrémentale disponible nécessite 
%{memory_needed}s de mémoire libre mais seulement %{free_memory}s est libre.
 
-#: ../lib/Tails/IUK/Frontend.pm:356
+#: ../lib/Tails/IUK/Frontend.pm:360
 msgid 
 An incremental upgrade is available, but no full upgrade is.\n
 This should not happen. Please report a bug.
 msgstr Une mise à niveau incrémentale est disponible, mais aucune mise à 
niveau complète.\nCela ne devrait pas arriver. Veuillez rapporter un bogue.
 
-#: ../lib/Tails/IUK/Frontend.pm:360
+#: ../lib/Tails/IUK/Frontend.pm:364
 msgid Error while detecting available upgrades
 msgstr Erreur lors de la vérification de mises à niveau disponibles
 
-#: ../lib/Tails/IUK/Frontend.pm:370
+#: ../lib/Tails/IUK/Frontend.pm:374
 #, perl-brace-format
 msgid 
 bYou should upgrade to %{name}s %{version}s./b\n
@@ -111,19 +115,19 @@ msgid 
 Do you want to upgrade now?
 msgstr bVous devriez mettre à niveau vers %{name}s 
%{version}s./b\n\nPour plus d'informations sur cette nouvelle version, aller 
à %{details_url}s\n\nIl est recommandé de fermer toutes les applications 
durant la mise à niveau.\nLe téléchargement de la mise à niveau peut 
prendre longtemps, de plusieurs minutes à quelques heures.\nLe réseau sera 
désactivé après le téléchargement de la mise à niveau.\n\nTaille du 
téléchargements : %{size}s\n\nVoulez-vous mettre à niveau maintenant?
 
-#: ../lib/Tails/IUK/Frontend.pm:385
+#: ../lib/Tails/IUK/Frontend.pm:389
 msgid Upgrade available
 msgstr Mise à niveau disponible
 
-#: ../lib/Tails/IUK/Frontend.pm:386
+#: ../lib/Tails/IUK/Frontend.pm:390
 msgid Upgrade now
 msgstr Mettre à niveau maintenant
 
-#: ../lib/Tails/IUK/Frontend.pm:387
+#: ../lib/Tails/IUK/Frontend.pm:391
 msgid Upgrade later
 msgstr Mettre à niveau plus tard
 
-#: ../lib/Tails/IUK/Frontend.pm:395
+#: ../lib/Tails/IUK/Frontend.pm:399
 #, perl-brace-format
 msgid 
 bYou should do a manual upgrade to %{name}s %{version}s./b\n
@@ -135,20 +139,20 @@ msgid 
 To learn how to do a manual upgrade, go to 
https://tails.boum.org/doc/first_steps/upgrade/#manual;
 msgstr bVous devriez mettre à niveau manuellement vers 

[tor-commits] [translation/tails-iuk] Update translations for tails-iuk

2014-09-01 Thread translation
commit 932dcdaac5f0cbfeaa705f6be34b758821dcb126
Author: Translation commit bot translat...@torproject.org
Date:   Mon Sep 1 13:45:47 2014 +

Update translations for tails-iuk
---
 es.po |6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/es.po b/es.po
index 4ea597f..592ced3 100644
--- a/es.po
+++ b/es.po
@@ -10,8 +10,8 @@ msgstr 
 Project-Id-Version: The Tor Project\n
 Report-Msgid-Bugs-To: Tails developers ta...@boum.org\n
 POT-Creation-Date: 2014-08-31 15:23+0200\n
-PO-Revision-Date: 2014-09-01 09:20+\n
-Last-Translator: runasand runa.sand...@gmail.com\n
+PO-Revision-Date: 2014-09-01 13:41+\n
+Last-Translator: strel\n
 Language-Team: Spanish 
(http://www.transifex.com/projects/p/torproject/language/es/)\n
 MIME-Version: 1.0\n
 Content-Type: text/plain; charset=UTF-8\n
@@ -64,7 +64,7 @@ msgstr No hay una explicación disponible por motivo de 
'%{reason}s'.
 
 #: ../lib/Tails/IUK/Frontend.pm:279
 msgid XXX HEJ XXX
-msgstr 
+msgstr XXX HEJ XXX
 
 #: ../lib/Tails/IUK/Frontend.pm:285
 msgid The system is up-to-date

___
tor-commits mailing list
tor-commits@lists.torproject.org
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits


[tor-commits] [translation/tails-iuk_completed] Update translations for tails-iuk_completed

2014-09-01 Thread translation
commit 37597533505b2f0dbfd54f871d40ab5c0e214c83
Author: Translation commit bot translat...@torproject.org
Date:   Mon Sep 1 13:45:49 2014 +

Update translations for tails-iuk_completed
---
 es.po |   76 ++---
 1 file changed, 40 insertions(+), 36 deletions(-)

diff --git a/es.po b/es.po
index 54d69c8..592ced3 100644
--- a/es.po
+++ b/es.po
@@ -9,9 +9,9 @@ msgid 
 msgstr 
 Project-Id-Version: The Tor Project\n
 Report-Msgid-Bugs-To: Tails developers ta...@boum.org\n
-POT-Creation-Date: 2014-06-24 11:44+0200\n
-PO-Revision-Date: 2014-08-21 10:01+\n
-Last-Translator: Emma Peel\n
+POT-Creation-Date: 2014-08-31 15:23+0200\n
+PO-Revision-Date: 2014-09-01 13:41+\n
+Last-Translator: strel\n
 Language-Team: Spanish 
(http://www.transifex.com/projects/p/torproject/language/es/)\n
 MIME-Version: 1.0\n
 Content-Type: text/plain; charset=UTF-8\n
@@ -19,8 +19,8 @@ msgstr 
 Language: es\n
 Plural-Forms: nplurals=2; plural=(n != 1);\n
 
-#: ../lib/Tails/IUK/Frontend.pm:146 ../lib/Tails/IUK/Frontend.pm:523
-#: ../lib/Tails/IUK/Frontend.pm:667
+#: ../lib/Tails/IUK/Frontend.pm:146 ../lib/Tails/IUK/Frontend.pm:527
+#: ../lib/Tails/IUK/Frontend.pm:671
 msgid For debugging information, see /home/amnesia/.xsession-errors
 msgstr Para información de depuración, vea ~/.xsession-errors .
 
@@ -62,39 +62,43 @@ msgstr no hay suficiente memoria libre en este sistema
 msgid No explanation available for reason '%{reason}s'.
 msgstr No hay una explicación disponible por motivo de '%{reason}s'.
 
-#: ../lib/Tails/IUK/Frontend.pm:281
+#: ../lib/Tails/IUK/Frontend.pm:279
+msgid XXX HEJ XXX
+msgstr XXX HEJ XXX
+
+#: ../lib/Tails/IUK/Frontend.pm:285
 msgid The system is up-to-date
 msgstr El sistema está actualizado
 
-#: ../lib/Tails/IUK/Frontend.pm:286
+#: ../lib/Tails/IUK/Frontend.pm:290
 msgid This version of Tails is outdated, and may have security issues.
 msgstr Esta versión de Tails está desfasada, y puede tener problemas de 
seguridad.
 
-#: ../lib/Tails/IUK/Frontend.pm:318
+#: ../lib/Tails/IUK/Frontend.pm:322
 #, perl-brace-format
 msgid 
 The available incremental upgrade requires %{space_needed}s of free space on
  Tails system partition,  but only %{free_space}s is available.
 msgstr La actualización incremental disponible requiere %{space_needed}s de 
espacio libre en la partición de sistema de Tails, pero sólo hay 
%{free_space}s disponible(s).
 
-#: ../lib/Tails/IUK/Frontend.pm:334
+#: ../lib/Tails/IUK/Frontend.pm:338
 #, perl-brace-format
 msgid 
 The available incremental upgrade requires %{memory_needed}s of free memory,
  but only %{free_memory}s is available.
 msgstr La actualización incremental disponible requiere %{memory_needed}s de 
memoria libre, pero sólo hay %{memory_needed}s disponible(s).
 
-#: ../lib/Tails/IUK/Frontend.pm:356
+#: ../lib/Tails/IUK/Frontend.pm:360
 msgid 
 An incremental upgrade is available, but no full upgrade is.\n
 This should not happen. Please report a bug.
 msgstr Está disponible una actualización incremental, pero no está 
disponible ninguna actualización completa.\nEsto no debería ocurrir. Por 
favor informe del fallo.
 
-#: ../lib/Tails/IUK/Frontend.pm:360
+#: ../lib/Tails/IUK/Frontend.pm:364
 msgid Error while detecting available upgrades
 msgstr Error al comprobar si hay actualizaciones
 
-#: ../lib/Tails/IUK/Frontend.pm:370
+#: ../lib/Tails/IUK/Frontend.pm:374
 #, perl-brace-format
 msgid 
 bYou should upgrade to %{name}s %{version}s./b\n
@@ -110,19 +114,19 @@ msgid 
 Do you want to upgrade now?
 msgstr bDebe actualizar a %{name}s %{version}s./b\n\nPara más 
información acerca de esta nueva versión, vaya a %{details_url}s\n\nDurante 
la actualización se recomienda cerrar todas las aplicaciones 
abiertas.\nDescargar la actualización podría llevar mucho tiempo, desde 
varios minutos a unas pocas horas.\nLa red será deshabilitada después de 
descargar la actualización.\n\nTamaño de la descarga: %{size}s\n\n¿Quiere 
actualizar ahora?
 
-#: ../lib/Tails/IUK/Frontend.pm:385
+#: ../lib/Tails/IUK/Frontend.pm:389
 msgid Upgrade available
 msgstr Actualización disponible
 
-#: ../lib/Tails/IUK/Frontend.pm:386
+#: ../lib/Tails/IUK/Frontend.pm:390
 msgid Upgrade now
 msgstr Actualizar ahora
 
-#: ../lib/Tails/IUK/Frontend.pm:387
+#: ../lib/Tails/IUK/Frontend.pm:391
 msgid Upgrade later
 msgstr Actualizar más tarde
 
-#: ../lib/Tails/IUK/Frontend.pm:395
+#: ../lib/Tails/IUK/Frontend.pm:399
 #, perl-brace-format
 msgid 
 bYou should do a manual upgrade to %{name}s %{version}s./b\n
@@ -134,20 +138,20 @@ msgid 
 To learn how to do a manual upgrade, go to 
https://tails.boum.org/doc/first_steps/upgrade/#manual;
 msgstr bDebe hacer una actualización manual a %{name}s 
%{version}s./b\n\nPara más información acerca de esta nueva versión, vaya 
a %{details_url}s\n\nNo es posible actualizar automáticamente su dispositivo a 
esta nueva versión: %{explanation}s.\n\nPara aprender cómo hacer una 

[tor-commits] [translation/tails-iuk] Update translations for tails-iuk

2014-09-01 Thread translation
commit 451263b2da30d2ed8ef88dadfcb924a1939d3995
Author: Translation commit bot translat...@torproject.org
Date:   Mon Sep 1 14:15:45 2014 +

Update translations for tails-iuk
---
 es.po |2 +-
 it.po |7 ---
 2 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/es.po b/es.po
index 592ced3..59288a2 100644
--- a/es.po
+++ b/es.po
@@ -10,7 +10,7 @@ msgstr 
 Project-Id-Version: The Tor Project\n
 Report-Msgid-Bugs-To: Tails developers ta...@boum.org\n
 POT-Creation-Date: 2014-08-31 15:23+0200\n
-PO-Revision-Date: 2014-09-01 13:41+\n
+PO-Revision-Date: 2014-09-01 13:50+\n
 Last-Translator: strel\n
 Language-Team: Spanish 
(http://www.transifex.com/projects/p/torproject/language/es/)\n
 MIME-Version: 1.0\n
diff --git a/it.po b/it.po
index d1a18f7..d3f9a60 100644
--- a/it.po
+++ b/it.po
@@ -12,13 +12,14 @@
 # alessandra al3l...@autistici.org, 2014
 # Random_R, 2013-2014
 # Spartaco Pragnesco c...@anche.no, 2013
+# topos97 tompra...@gmail.com, 2014
 msgid 
 msgstr 
 Project-Id-Version: The Tor Project\n
 Report-Msgid-Bugs-To: Tails developers ta...@boum.org\n
 POT-Creation-Date: 2014-08-31 15:23+0200\n
-PO-Revision-Date: 2014-09-01 09:20+\n
-Last-Translator: runasand runa.sand...@gmail.com\n
+PO-Revision-Date: 2014-09-01 14:12+\n
+Last-Translator: topos97 tompra...@gmail.com\n
 Language-Team: Italian 
(http://www.transifex.com/projects/p/torproject/language/it/)\n
 MIME-Version: 1.0\n
 Content-Type: text/plain; charset=UTF-8\n
@@ -71,7 +72,7 @@ msgstr Nessuna spiegazione disponibile per '%{reason}s'.
 
 #: ../lib/Tails/IUK/Frontend.pm:279
 msgid XXX HEJ XXX
-msgstr 
+msgstr XXX HEJ XXX
 
 #: ../lib/Tails/IUK/Frontend.pm:285
 msgid The system is up-to-date

___
tor-commits mailing list
tor-commits@lists.torproject.org
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits


[tor-commits] [translation/tails-iuk_completed] Update translations for tails-iuk_completed

2014-09-01 Thread translation
commit f54937e0b5583bc2895ecfe68da6e21030ec52e3
Author: Translation commit bot translat...@torproject.org
Date:   Mon Sep 1 14:15:49 2014 +

Update translations for tails-iuk_completed
---
 es.po |2 +-
 it.po |   85 ++---
 2 files changed, 46 insertions(+), 41 deletions(-)

diff --git a/es.po b/es.po
index 592ced3..59288a2 100644
--- a/es.po
+++ b/es.po
@@ -10,7 +10,7 @@ msgstr 
 Project-Id-Version: The Tor Project\n
 Report-Msgid-Bugs-To: Tails developers ta...@boum.org\n
 POT-Creation-Date: 2014-08-31 15:23+0200\n
-PO-Revision-Date: 2014-09-01 13:41+\n
+PO-Revision-Date: 2014-09-01 13:50+\n
 Last-Translator: strel\n
 Language-Team: Spanish 
(http://www.transifex.com/projects/p/torproject/language/es/)\n
 MIME-Version: 1.0\n
diff --git a/it.po b/it.po
index af126ee..d3f9a60 100644
--- a/it.po
+++ b/it.po
@@ -3,22 +3,23 @@
 # This file is distributed under the same license as the PACKAGE package.
 # 
 # Translators:
-# lilo al3l...@autistici.org, 2014
-# chap c...@anche.no, 2013
+# alessandra al3l...@autistici.org, 2014
+# Spartaco Pragnesco c...@anche.no, 2013
 # il_doc filippo.gi...@gmail.com, 2014
 # Francesca Ciceri madame...@zouish.org, 2014
 # Gaetano Gallozzi ggall...@gmail.com, 2013
 # il_doc filippo.gi...@gmail.com, 2014
-# lilo al3l...@autistici.org, 2014
+# alessandra al3l...@autistici.org, 2014
 # Random_R, 2013-2014
-# chap c...@anche.no, 2013
+# Spartaco Pragnesco c...@anche.no, 2013
+# topos97 tompra...@gmail.com, 2014
 msgid 
 msgstr 
 Project-Id-Version: The Tor Project\n
 Report-Msgid-Bugs-To: Tails developers ta...@boum.org\n
-POT-Creation-Date: 2014-04-16 17:54+0200\n
-PO-Revision-Date: 2014-04-28 13:20+\n
-Last-Translator: Francesca Ciceri madame...@zouish.org\n
+POT-Creation-Date: 2014-08-31 15:23+0200\n
+PO-Revision-Date: 2014-09-01 14:12+\n
+Last-Translator: topos97 tompra...@gmail.com\n
 Language-Team: Italian 
(http://www.transifex.com/projects/p/torproject/language/it/)\n
 MIME-Version: 1.0\n
 Content-Type: text/plain; charset=UTF-8\n
@@ -26,8 +27,8 @@ msgstr 
 Language: it\n
 Plural-Forms: nplurals=2; plural=(n != 1);\n
 
-#: ../lib/Tails/IUK/Frontend.pm:146 ../lib/Tails/IUK/Frontend.pm:523
-#: ../lib/Tails/IUK/Frontend.pm:667
+#: ../lib/Tails/IUK/Frontend.pm:146 ../lib/Tails/IUK/Frontend.pm:527
+#: ../lib/Tails/IUK/Frontend.pm:671
 msgid For debugging information, see /home/amnesia/.xsession-errors
 msgstr Per informazioni di debug, si veda /home/amnesia/.xsession-errors
 
@@ -69,39 +70,43 @@ msgstr la memoria disponibile nel sistema non è 
sufficiente
 msgid No explanation available for reason '%{reason}s'.
 msgstr Nessuna spiegazione disponibile per '%{reason}s'.
 
-#: ../lib/Tails/IUK/Frontend.pm:281
+#: ../lib/Tails/IUK/Frontend.pm:279
+msgid XXX HEJ XXX
+msgstr XXX HEJ XXX
+
+#: ../lib/Tails/IUK/Frontend.pm:285
 msgid The system is up-to-date
 msgstr Il sistema è aggiornato
 
-#: ../lib/Tails/IUK/Frontend.pm:286
+#: ../lib/Tails/IUK/Frontend.pm:290
 msgid This version of Tails is outdated, and may have security issues.
 msgstr Questa versione di Tails è obsoleta e potrebbe avere problemi di 
sicurezza.
 
-#: ../lib/Tails/IUK/Frontend.pm:318
+#: ../lib/Tails/IUK/Frontend.pm:322
 #, perl-brace-format
 msgid 
 The available incremental upgrade requires %{space_needed}s of free space on
  Tails system partition,  but only %{free_space}s is available.
 msgstr L'aggiornamento incrementale disponibile richiede %{space_needed}s di 
spazio libero nella partizione di sistema di Tails, ma sono disponibili solo 
%{free_space}s .
 
-#: ../lib/Tails/IUK/Frontend.pm:334
+#: ../lib/Tails/IUK/Frontend.pm:338
 #, perl-brace-format
 msgid 
 The available incremental upgrade requires %{memory_needed}s of free memory,
  but only %{free_memory}s is available.
 msgstr L'aggiornamento incrementale disponibile richiede %{memory_needed}s di 
memoria libera, ma sono disponibili solo %{free_memory}s .
 
-#: ../lib/Tails/IUK/Frontend.pm:356
+#: ../lib/Tails/IUK/Frontend.pm:360
 msgid 
 An incremental upgrade is available, but no full upgrade is.\n
 This should not happen. Please report a bug.
 msgstr Un aggiornamento incrementale è disponibile, ma non un aggiornamento 
completo.\nQuesto non dovrebbe accadere. Si prega di segnalare l'errore.
 
-#: ../lib/Tails/IUK/Frontend.pm:360
+#: ../lib/Tails/IUK/Frontend.pm:364
 msgid Error while detecting available upgrades
 msgstr Errore durante il rilevamento di aggiornamenti disponibili
 
-#: ../lib/Tails/IUK/Frontend.pm:370
+#: ../lib/Tails/IUK/Frontend.pm:374
 #, perl-brace-format
 msgid 
 bYou should upgrade to %{name}s %{version}s./b\n
@@ -117,19 +122,19 @@ msgid 
 Do you want to upgrade now?
 msgstr bSi dovrebbe aggiornare a %{name}s %{version}s./b\n\nPer maggiori 
informazioni su questa nuova versione, visitare %{details_url}s.\n\nSi 
raccomanda di chiudere tutte le applicazioni aperte durante 
l'aggiornamento.\nScaricare l'aggiornamento potrebbe richiedere molto 

[tor-commits] [translation/tails-iuk_completed] Update translations for tails-iuk_completed

2014-09-01 Thread translation
commit 4687dda69d3a23154a7ad6e188da1ae470b30627
Author: Translation commit bot translat...@torproject.org
Date:   Mon Sep 1 15:15:52 2014 +

Update translations for tails-iuk_completed
---
 fr_CA.po |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fr_CA.po b/fr_CA.po
index 6677b8c..f0dd25c 100644
--- a/fr_CA.po
+++ b/fr_CA.po
@@ -11,7 +11,7 @@ msgstr 
 Project-Id-Version: The Tor Project\n
 Report-Msgid-Bugs-To: Tails developers ta...@boum.org\n
 POT-Creation-Date: 2014-08-31 15:23+0200\n
-PO-Revision-Date: 2014-09-01 12:40+\n
+PO-Revision-Date: 2014-09-01 15:10+\n
 Last-Translator: yahoe.001\n
 Language-Team: French (Canada) 
(http://www.transifex.com/projects/p/torproject/language/fr_CA/)\n
 MIME-Version: 1.0\n

___
tor-commits mailing list
tor-commits@lists.torproject.org
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits


[tor-commits] [translation/tails-iuk] Update translations for tails-iuk

2014-09-01 Thread translation
commit f054d686ff80e98535fdbac023428d238631a575
Author: Translation commit bot translat...@torproject.org
Date:   Mon Sep 1 15:15:48 2014 +

Update translations for tails-iuk
---
 fr_CA.po |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fr_CA.po b/fr_CA.po
index 6677b8c..f0dd25c 100644
--- a/fr_CA.po
+++ b/fr_CA.po
@@ -11,7 +11,7 @@ msgstr 
 Project-Id-Version: The Tor Project\n
 Report-Msgid-Bugs-To: Tails developers ta...@boum.org\n
 POT-Creation-Date: 2014-08-31 15:23+0200\n
-PO-Revision-Date: 2014-09-01 12:40+\n
+PO-Revision-Date: 2014-09-01 15:10+\n
 Last-Translator: yahoe.001\n
 Language-Team: French (Canada) 
(http://www.transifex.com/projects/p/torproject/language/fr_CA/)\n
 MIME-Version: 1.0\n

___
tor-commits mailing list
tor-commits@lists.torproject.org
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits


[tor-commits] r26935: {website} add new mirror (website/trunk/include)

2014-09-01 Thread Andrew Lewman
Author: phobos
Date: 2014-09-01 17:02:08 + (Mon, 01 Sep 2014)
New Revision: 26935

Modified:
   website/trunk/include/tor-mirrors.csv
Log:
add new mirror


Modified: website/trunk/include/tor-mirrors.csv
===
--- website/trunk/include/tor-mirrors.csv   2014-09-01 04:35:54 UTC (rev 
26934)
+++ website/trunk/include/tor-mirrors.csv   2014-09-01 17:02:08 UTC (rev 
26935)
@@ -107,3 +107,4 @@
 Tor Fan, Tor Supporter, DE, Germany, Europe, TRUE, FALSE, No, 
http://tor.euve33747.vserver.de/, , , , http://tor.euve33747.vserver.de/dist, , 
, , Thu Aug 28 20:15:25 2014
 calebcen...@live.com, calebxu.tk, US, United States, US, TRUE, FALSE, NO, 
http://tor.calebxu.tk, , rsync://calebxu.tk/tor, ftp://ftp.calebxu.tk, 
http://tor.calebxu.tk/dist, , , , 
 s7r[at]sky-ip[d0t]org, sky-ip.org, NL, Netherlands, NL, TRUE, FALSE, No, 
http://beautiful-mind.sky-ip.org/, , , , 
http://beautiful-mind.sky-ip.org/dist/, , , , Thu Aug 28 20:15:25 2014
+tor#pajonzeck#de,ITsn,DE,Germany,Europe,TRUE,FALSE,No,http://tor.pajonzeck.de/,https://tor.pajonzeck.de/,rsync://tor.pajonzeck.de/tor,,http://tor.pajonzeck.de/dist/,https://tor.pajonzeck.de/dist/,rsync://tor.pajonzeck.de/tor/dist,http://zgfgvob256pffy62.onion

___
tor-commits mailing list
tor-commits@lists.torproject.org
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits


[tor-commits] r26936: {website} Fix some formatting from previous 'volunteer' commit. (website/trunk/getinvolved/en)

2014-09-01 Thread Matt Pagan
Author: mttp
Date: 2014-09-01 18:24:36 + (Mon, 01 Sep 2014)
New Revision: 26936

Modified:
   website/trunk/getinvolved/en/volunteer.wml
Log:
Fix some formatting from previous 'volunteer' commit.



Modified: website/trunk/getinvolved/en/volunteer.wml
===
--- website/trunk/getinvolved/en/volunteer.wml  2014-09-01 17:02:08 UTC (rev 
26935)
+++ website/trunk/getinvolved/en/volunteer.wml  2014-09-01 18:24:36 UTC (rev 
26936)
@@ -499,11 +499,12 @@
 tracker/a)/h3
 
 p
-Firefox addon that interfaces between the browser components and Tor. It 
+Firefox addon that interfaces between the Tor Browser's browser components 
+and Tor. It 
 addresses many usability issues of Tor Browser by making certain common 
 Tor configurations, like bridge use, easy to set. Kathy and Mark of Pearl 
 Crescent continue to add improvements as Tor Browser's feature set 
-increases. /a.
+increases. 
 /p
 
 a id=project-httpseverywhere/a

___
tor-commits mailing list
tor-commits@lists.torproject.org
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits


[tor-commits] [tor/master] Bounds check while looping over a fixed size table or array

2014-09-01 Thread nickm
commit 60a3897ed9ed4fa81253fffa67d4f0c178090bbd
Author: Philip Van Hoof phi...@codeminded.be
Date:   Sat Aug 23 00:35:26 2014 +0200

Bounds check while looping over a fixed size table or array

(Edited to use existing ARRAY_LENGTH macro --nickm)
---
 src/or/entrynodes.c |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/or/entrynodes.c b/src/or/entrynodes.c
index edf766b..b5dd09f 100644
--- a/src/or/entrynodes.c
+++ b/src/or/entrynodes.c
@@ -182,7 +182,7 @@ entry_is_time_to_retry(const entry_guard_t *e, time_t now)
 
   unreachable_for = now - e-unreachable_since;
 
-  for (i = 0; ; i++) {
+  for (i = 0; i  ARRAY_LENGTH(periods); i++) {
 if (unreachable_for = periods[i].period_duration) {
   ith_deadline_for_retry = e-last_attempted +
periods[i].interval_during_period;
@@ -190,6 +190,7 @@ entry_is_time_to_retry(const entry_guard_t *e, time_t now)
   return (now  ith_deadline_for_retry);
 }
   }
+  return 0;
 }
 
 /** Return the node corresponding to be/b, if be/b is

___
tor-commits mailing list
tor-commits@lists.torproject.org
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits


[tor-commits] [tor/master] Avoid unsigned/sign compare warning from last patch.

2014-09-01 Thread nickm
commit 87f9c51f6423230c2b6f7dfbd1c76975a39aece0
Author: Nick Mathewson ni...@torproject.org
Date:   Mon Sep 1 15:42:17 2014 -0400

Avoid unsigned/sign compare warning from last patch.
---
 src/or/entrynodes.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/or/entrynodes.c b/src/or/entrynodes.c
index b5dd09f..b95391e 100644
--- a/src/or/entrynodes.c
+++ b/src/or/entrynodes.c
@@ -175,7 +175,7 @@ entry_is_time_to_retry(const entry_guard_t *e, time_t now)
 
   time_t ith_deadline_for_retry;
   time_t unreachable_for;
-  int i;
+  unsigned i;
 
   if (e-last_attempted  e-unreachable_since)
 return 1;

___
tor-commits mailing list
tor-commits@lists.torproject.org
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits


[tor-commits] [torspec/master] Specify how Guard Fraction voting should occur.

2014-09-01 Thread nickm
commit 7647f6d4de98acae6b71782648b0a646f11b146a
Author: George Kadianakis desnac...@riseup.net
Date:   Sun Aug 31 16:27:35 2014 +0300

Specify how Guard Fraction voting should occur.
---
 proposals/236-single-guard-node.txt |   26 +-
 1 file changed, 21 insertions(+), 5 deletions(-)

diff --git a/proposals/236-single-guard-node.txt 
b/proposals/236-single-guard-node.txt
index d7c03d3..32327db 100644
--- a/proposals/236-single-guard-node.txt
+++ b/proposals/236-single-guard-node.txt
@@ -110,12 +110,14 @@ Status: Open
To do so, everytime an authority needs to vote for a guard, it
reads a set of consensus documents spanning the past NNN months,
where NNN is the number of months in the guard rotation period (10
-   months if this proposal is adopted in full) and calculates the
-   visibility of the guard; that is, in how many consensuses it has
-   had the guard flag.
+   months if this proposal is adopted in full) and calculates in how
+   many consensuses it has had the guard flag for.
 
-   The authorities include the age of each guard by appending
-   '[SP GV= INT]' in the guard's w line.
+   Then, in their votes, the authorities include the Guard Fraction of
+   each guard by appending '[SP GuardFraction= INT]' in the guard's
+   w line. Its value is an integer between 0 and 100, with 0 meaning
+   that it's a brand new guard, and 100 that it has been present in
+   all the inspected consensuses.
 
A guard N that has been visible for V out of NNN*30*24 consensuses
has had the opportunity to be chosen as a guard by approximately
@@ -142,6 +144,20 @@ Status: Open
D' = D + F*B, if N has the exit flag
E' = E + (1-F)*B, if N has the exit flag
 
+1.3.1. Guard Fraction voting
+
+  To pass that information to clients, we introduce consensus method
+  19, where if 3 or more authorities provided GuardFraction values in
+  their votes, the authorities produce a consensus containing a
+  GuardFraction keyword equal to the low-median of the GuardFraction
+  votes.
+
+  The GuardFraction keyword is appended in the 'w' line of each router
+  in the consensus, after the optional 'Unmeasured' keyword. Example:
+w Bandwidth=20 Unmeasured=1 GuardFraction=66
+  or
+w Bandwidth=53600 GuardFraction=99
+
 1.4. Raise the bandwidth threshold for being a guard
 
From dir-spec.txt:

___
tor-commits mailing list
tor-commits@lists.torproject.org
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits


[tor-commits] [tor/maint-0.2.5] Adding changes file.

2014-09-01 Thread nickm
commit 8139db372528ca02cd572f3f7848e9d174a9b12e
Author: rl1987 rl1...@sdf.lonestar.org
Date:   Sun Aug 31 14:35:30 2014 +0300

Adding changes file.
---
 changes/bug12878 |3 +++
 1 file changed, 3 insertions(+)

diff --git a/changes/bug12878 b/changes/bug12878
new file mode 100644
index 000..a05fc44
--- /dev/null
+++ b/changes/bug12878
@@ -0,0 +1,3 @@
+  o Documentation:
+- Document 'reject6' and 'accept6' ExitPolicy entries. Resolves 
+  ticket 12878.

___
tor-commits mailing list
tor-commits@lists.torproject.org
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits


[tor-commits] [tor/master] Merge remote-tracking branch 'origin/maint-0.2.5'

2014-09-01 Thread nickm
commit 67c0ad54263be7fb742a8d499f97f5908f9ec970
Merge: 87f9c51 8139db3
Author: Nick Mathewson ni...@torproject.org
Date:   Mon Sep 1 16:23:34 2014 -0400

Merge remote-tracking branch 'origin/maint-0.2.5'

 changes/bug12878 |3 +++
 1 file changed, 3 insertions(+)

___
tor-commits mailing list
tor-commits@lists.torproject.org
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits


[tor-commits] [tor/master] Adding changes file.

2014-09-01 Thread nickm
commit 8139db372528ca02cd572f3f7848e9d174a9b12e
Author: rl1987 rl1...@sdf.lonestar.org
Date:   Sun Aug 31 14:35:30 2014 +0300

Adding changes file.
---
 changes/bug12878 |3 +++
 1 file changed, 3 insertions(+)

diff --git a/changes/bug12878 b/changes/bug12878
new file mode 100644
index 000..a05fc44
--- /dev/null
+++ b/changes/bug12878
@@ -0,0 +1,3 @@
+  o Documentation:
+- Document 'reject6' and 'accept6' ExitPolicy entries. Resolves 
+  ticket 12878.



___
tor-commits mailing list
tor-commits@lists.torproject.org
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits


[tor-commits] [translation/bridgedb] Update translations for bridgedb

2014-09-01 Thread translation
commit cb7877a198dee7e544a8ef0ca236662e254cb1cc
Author: Translation commit bot translat...@torproject.org
Date:   Tue Sep 2 00:45:03 2014 +

Update translations for bridgedb
---
 ms_MY/LC_MESSAGES/bridgedb.po |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/ms_MY/LC_MESSAGES/bridgedb.po b/ms_MY/LC_MESSAGES/bridgedb.po
index ec3cfaf..ba244fa 100644
--- a/ms_MY/LC_MESSAGES/bridgedb.po
+++ b/ms_MY/LC_MESSAGES/bridgedb.po
@@ -11,7 +11,7 @@ msgstr 
 Project-Id-Version: The Tor Project\n
 Report-Msgid-Bugs-To: 
'https://trac.torproject.org/projects/tor/newticket?component=BridgeDBkeywords=bridgedb-reported,msgidcc=isis,sysrqbowner=isis'\n
 POT-Creation-Date: 2014-07-26 02:11+\n
-PO-Revision-Date: 2014-08-03 03:20+\n
+PO-Revision-Date: 2014-09-02 00:40+\n
 Last-Translator: kz_gtr kz_...@yahoo.com\n
 Language-Team: Malay (Malaysia) 
(http://www.transifex.com/projects/p/torproject/language/ms_MY/)\n
 MIME-Version: 1.0\n

___
tor-commits mailing list
tor-commits@lists.torproject.org
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits


[tor-commits] [translation/tails-greeter] Update translations for tails-greeter

2014-09-01 Thread translation
commit 20b9be905d9ccf7fc5d56a23c287277e3303805a
Author: Translation commit bot translat...@torproject.org
Date:   Tue Sep 2 00:45:26 2014 +

Update translations for tails-greeter
---
 ms_MY/ms_MY.po |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/ms_MY/ms_MY.po b/ms_MY/ms_MY.po
index 5fbc6b2..b9c5bf0 100644
--- a/ms_MY/ms_MY.po
+++ b/ms_MY/ms_MY.po
@@ -9,8 +9,8 @@ msgid 
 msgstr 
 Project-Id-Version: The Tor Project\n
 Report-Msgid-Bugs-To: \n
-POT-Creation-Date: 2014-07-20 18:36+0200\n
-PO-Revision-Date: 2014-08-16 02:50+\n
+POT-Creation-Date: 2014-08-31 10:36+0200\n
+PO-Revision-Date: 2014-09-02 00:40+\n
 Last-Translator: kz_gtr kz_...@yahoo.com\n
 Language-Team: Malay (Malaysia) 
(http://www.transifex.com/projects/p/torproject/language/ms_MY/)\n
 MIME-Version: 1.0\n

___
tor-commits mailing list
tor-commits@lists.torproject.org
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits


[tor-commits] [support-tools/master] Add queue graphs data for August 2014

2014-09-01 Thread lunar
commit d7779f9a0a065b3d9142b94de297183faaa7
Author: Lunar lu...@torproject.org
Date:   Tue Sep 2 01:01:00 2014 +

Add queue graphs data for August 2014
---
 queue-graphs/data/2014Q3.csv |6 ++
 1 file changed, 6 insertions(+)

diff --git a/queue-graphs/data/2014Q3.csv b/queue-graphs/data/2014Q3.csv
index 4ce9d25..4208896 100644
--- a/queue-graphs/data/2014Q3.csv
+++ b/queue-graphs/data/2014Q3.csv
@@ -5,3 +5,9 @@ month,queue,newtickets
 2014-07,fa,156
 2014-07,fr,37
 2014-07,zh,73
+2014-08,ar,8
+2014-08,en,1098
+2014-08,es,61
+2014-08,fa,241
+2014-08,fr,33
+2014-08,zh,76



___
tor-commits mailing list
tor-commits@lists.torproject.org
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits


[tor-commits] [support-tools/master] Add response time data for August 2014

2014-09-01 Thread lunar
commit 3998c080d4300e6ed215668f08808ac1b99ab1a4
Author: Lunar lu...@torproject.org
Date:   Tue Sep 2 01:02:23 2014 +

Add response time data for August 2014
---
 response-time/data/2014Q3.csv |  189 +
 1 file changed, 189 insertions(+)

diff --git a/response-time/data/2014Q3.csv b/response-time/data/2014Q3.csv
index 1dab19e..fd4b41c 100644
--- a/response-time/data/2014Q3.csv
+++ b/response-time/data/2014Q3.csv
@@ -175,3 +175,192 @@ month,fromhours,tohours,requests
 2014-07,4850,4851,1
 2014-07,5740,5741,1
 2014-07,7271,7272,1
+2014-08,0,1,331
+2014-08,1,2,153
+2014-08,2,3,114
+2014-08,3,4,92
+2014-08,4,5,82
+2014-08,5,6,82
+2014-08,6,7,60
+2014-08,7,8,69
+2014-08,8,9,70
+2014-08,9,10,41
+2014-08,10,11,57
+2014-08,11,12,52
+2014-08,12,13,48
+2014-08,13,14,40
+2014-08,14,15,39
+2014-08,15,16,47
+2014-08,16,17,47
+2014-08,17,18,39
+2014-08,18,19,35
+2014-08,19,20,39
+2014-08,20,21,45
+2014-08,21,22,34
+2014-08,22,23,39
+2014-08,23,24,37
+2014-08,24,25,34
+2014-08,25,26,30
+2014-08,26,27,29
+2014-08,27,28,26
+2014-08,28,29,16
+2014-08,29,30,17
+2014-08,30,31,24
+2014-08,31,32,11
+2014-08,32,33,21
+2014-08,33,34,20
+2014-08,34,35,13
+2014-08,35,36,19
+2014-08,36,37,8
+2014-08,37,38,14
+2014-08,38,39,9
+2014-08,39,40,19
+2014-08,40,41,12
+2014-08,41,42,13
+2014-08,42,43,9
+2014-08,43,44,13
+2014-08,44,45,13
+2014-08,45,46,12
+2014-08,46,47,11
+2014-08,47,48,21
+2014-08,48,49,13
+2014-08,49,50,9
+2014-08,50,51,14
+2014-08,51,52,6
+2014-08,52,53,12
+2014-08,53,54,10
+2014-08,54,55,13
+2014-08,55,56,7
+2014-08,56,57,10
+2014-08,57,58,9
+2014-08,58,59,4
+2014-08,59,60,7
+2014-08,60,61,3
+2014-08,61,62,7
+2014-08,62,63,4
+2014-08,63,64,3
+2014-08,64,65,5
+2014-08,65,66,4
+2014-08,66,67,6
+2014-08,67,68,6
+2014-08,68,69,6
+2014-08,69,70,5
+2014-08,70,71,6
+2014-08,71,72,12
+2014-08,72,73,6
+2014-08,73,74,7
+2014-08,74,75,3
+2014-08,75,76,7
+2014-08,76,77,5
+2014-08,77,78,4
+2014-08,78,79,3
+2014-08,79,80,4
+2014-08,80,81,3
+2014-08,81,82,3
+2014-08,82,83,4
+2014-08,83,84,6
+2014-08,84,85,3
+2014-08,85,86,1
+2014-08,86,87,5
+2014-08,87,88,4
+2014-08,88,89,3
+2014-08,89,90,4
+2014-08,90,91,5
+2014-08,91,92,7
+2014-08,92,93,4
+2014-08,93,94,5
+2014-08,94,95,5
+2014-08,95,96,5
+2014-08,96,97,9
+2014-08,97,98,3
+2014-08,98,99,2
+2014-08,99,100,3
+2014-08,100,101,6
+2014-08,101,102,4
+2014-08,102,103,4
+2014-08,103,104,1
+2014-08,105,106,1
+2014-08,106,107,3
+2014-08,107,108,1
+2014-08,108,109,1
+2014-08,110,111,1
+2014-08,111,112,4
+2014-08,112,113,3
+2014-08,113,114,3
+2014-08,114,115,3
+2014-08,115,116,1
+2014-08,116,117,5
+2014-08,117,118,3
+2014-08,118,119,1
+2014-08,119,120,2
+2014-08,120,121,3
+2014-08,121,122,1
+2014-08,125,126,1
+2014-08,126,127,1
+2014-08,127,128,2
+2014-08,129,130,1
+2014-08,130,131,1
+2014-08,131,132,1
+2014-08,132,133,1
+2014-08,133,134,2
+2014-08,134,135,1
+2014-08,135,136,1
+2014-08,136,137,2
+2014-08,137,138,2
+2014-08,139,140,3
+2014-08,140,141,2
+2014-08,141,142,1
+2014-08,142,143,2
+2014-08,143,144,3
+2014-08,144,145,2
+2014-08,145,146,1
+2014-08,146,147,2
+2014-08,148,149,1
+2014-08,149,150,2
+2014-08,150,151,1
+2014-08,151,152,1
+2014-08,158,159,1
+2014-08,159,160,1
+2014-08,162,163,1
+2014-08,163,164,1
+2014-08,165,166,1
+2014-08,170,171,1
+2014-08,171,172,2
+2014-08,173,174,2
+2014-08,177,178,1
+2014-08,179,180,1
+2014-08,180,181,2
+2014-08,183,184,2
+2014-08,184,185,1
+2014-08,186,187,2
+2014-08,187,188,1
+2014-08,189,190,2
+2014-08,190,191,1
+2014-08,195,196,2
+2014-08,200,201,1
+2014-08,204,205,1
+2014-08,205,206,2
+2014-08,206,207,1
+2014-08,214,215,1
+2014-08,220,221,1
+2014-08,234,235,1
+2014-08,238,239,1
+2014-08,247,248,1
+2014-08,266,267,1
+2014-08,289,290,1
+2014-08,293,294,1
+2014-08,311,312,2
+2014-08,352,353,1
+2014-08,377,378,1
+2014-08,436,437,2
+2014-08,466,467,1
+2014-08,540,541,1
+2014-08,551,552,1
+2014-08,557,558,1
+2014-08,860,861,1
+2014-08,943,944,1
+2014-08,1187,1188,1
+2014-08,1223,1224,1
+2014-08,1398,1399,1
+2014-08,2312,2313,1
+2014-08,2975,2976,1

___
tor-commits mailing list
tor-commits@lists.torproject.org
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits


[tor-commits] r26938: {website} update mirror status. (website/trunk/include)

2014-09-01 Thread Andrew Lewman
Author: phobos
Date: 2014-09-02 03:40:33 + (Tue, 02 Sep 2014)
New Revision: 26938

Modified:
   website/trunk/include/mirrors-table.wmi
   website/trunk/include/tor-mirrors.csv
Log:
update mirror status.


Modified: website/trunk/include/mirrors-table.wmi
===
--- website/trunk/include/mirrors-table.wmi 2014-09-02 03:32:00 UTC (rev 
26937)
+++ website/trunk/include/mirrors-table.wmi 2014-09-02 03:40:33 UTC (rev 
26938)
@@ -1,1020 +0,0 @@
- 
-tr
-
- tdNO/td
-
- tdMultiNet AS/td
-
- tdUp to date/td
-
-td - /td
-tda href=http://tor.multinet.no/dist/;http/a/td
-tda href=http://tor.multinet.no/;http/a/td
-td - /td
-td - /td
-td - /td
-td - /td
-/tr
- 
-tr
-
- tdES/td
-
- tdTor Supporter/td
-
- tdUp to date/td
-
-td - /td
-tda href=http://tor.zilog.es/dist/;http/a/td
-tda href=http://tor.zilog.es/;http/a/td
-td - /td
-td - /td
-td - /td
-td - /td
-/tr
- 
-tr
-
- tdUS/td
-
- tdTor Supporter/td
-
- tdUp to date/td
-
-td - /td
-tda href=http://199.175.55.215/dist/;http/a/td
-tda href=http://199.175.55.215/;http/a/td
-td - /td
-td - /td
-td - /td
-td - /td
-/tr
- 
-tr
-
- tdEE/td
-
- tdCyberSIDE/td
-
- tdUp to date/td
-
-td - /td
-tda href=http://cyberside.net.ee/tor/;http/a/td
-tda href=http://cyberside.planet.ee/tor/;http/a/td
-td - /td
-td - /td
-td - /td
-td - /td
-/tr
- 
-tr
-
- tdIS/td
-
- tdtorproject.is/td
-
- tdUp to date/td
-
-td - /td
-tda href=http://torproject.is/dist/;http/a/td
-tda href=http://torproject.is/;http/a/td
-td - /td
-td - /td
-td - /td
-td - /td
-/tr
- 
-tr
-
- tdDE/td
-
- tdspline/td
-
- tdUp to date/td
-
-tda href=ftp://ftp.spline.de/pub/tor;ftp/a/td
-tda href=http://tor.spline.de/dist/;http/a/td
-tda href=http://tor.spline.de/;http/a/td
-tda href=https://tor.spline.inf.fu-berlin.de/dist/;https/a/td
-tda href=https://tor.spline.inf.fu-berlin.de/;https/a/td
-tda href=rsync://ftp.spline.de/tor/distrsync/a/td
-tda href=rsync://ftp.spline.de/torrsync/a/td
-/tr
- 
-tr
-
- tdRO/td
-
- tdme0w.cc/td
-
- tdUp to date/td
-
-td - /td
-tda href=http://tor.me0w.cc/dist/;http/a/td
-tda href=http://tor.me0w.cc/;http/a/td
-td - /td
-td - /td
-td - /td
-td - /td
-/tr
- 
-tr
-
- tdDE/td
-
- tdborgmann.tv/td
-
- tdUp to date/td
-
-td - /td
-tda href=http://tor.borgmann.tv/dist/;http/a/td
-tda href=http://tor.borgmann.tv/;http/a/td
-td - /td
-td - /td
-td - /td
-td - /td
-/tr
- 
-tr
-
- tdAT/td
-
- tdTor Supporter/td
-
- tdUp to date/td
-
-td - /td
-tda href=http://tor.dont-know-me.at/dist/;http/a/td
-tda href=http://tor.dont-know-me.at/;http/a/td
-td - /td
-td - /td
-td - /td
-td - /td
-/tr
- 
-tr
-
- tdINT/td
-
- tdCoralCDN/td
-
- tdUp to date/td
-
-td - /td
-tda href=http://www.torproject.org.nyud.net/dist/;http/a/td
-tda href=http://www.torproject.org.nyud.net/;http/a/td
-td - /td
-td - /td
-td - /td
-td - /td
-/tr
- 
-tr
-
- tdAT/td
-
- tdTor Supporter/td
-
- tdUp to date/td
-
-td - /td
-tda href=http://torproject.ph3x.at/dist/;http/a/td
-tda href=http://torproject.ph3x.at/;http/a/td
-td - /td
-td - /td
-td - /td
-td - /td
-/tr
- 
-tr
-
- tdBE/td
-
- tdteambelgium/td
-
- tdUp to date/td
-
-tda href=ftp://tor.teambelgium.net:2121/torproject/;ftp/a/td
-tda href=http://tor.teambelgium.net:8080/dist/;http/a/td
-tda href=http://tor.teambelgium.net:8080/;http/a/td
-td - /td
-td - /td
-td - /td
-td - /td
-/tr
- 
-tr
-
- tdDE/td
-
- tdbeme it/td
-
- tdUp to date/td
-
-td - /td
-tda href=http://tor.beme-it.de/dist/;http/a/td
-tda href=http://tor.beme-it.de/;http/a/td
-tda href=https://tor.beme-it.de/dist/;https/a/td
-tda href=https://tor.beme-it.de/;https/a/td
-tda href=rsync://tor.beme-it.de/tor/distrsync/a/td
-tda href=rsync://tor.beme-it.de/torrsync/a/td
-/tr
- 
-tr
-
- tdMX/td
-
- tdTor Supporter/td
-
- tdUp to date/td
-
-td - /td
-tda href=http://fbnaia.homelinux.net/torproject/dist/;http/a/td
-tda href=http://fbnaia.homelinux.net/torproject/;http/a/td
-tda href=https://fbnaia.homelinux.net/torproject/dist/;https/a/td
-tda href=https://fbnaia.homelinux.net/torproject/;https/a/td
-td - /td
-td - /td
-/tr
- 
-tr
-
- tdUS/td
-
- tdAskApache/td
-
- tdUp to date/td
-
-td - /td
-tda href=http://tor.askapache.com/dist/;http/a/td
-

[tor-commits] [stem/master] Dropping get_* prefix from proc functions

2014-09-01 Thread atagar
commit 666a831342cb1bc9311ae6e8767a10c4fd1dac5c
Author: Damian Johnson ata...@torproject.org
Date:   Mon Sep 1 16:49:04 2014 -0700

Dropping get_* prefix from proc functions

Just about all the proc functions started with get_*. Bad habbit from my 
days
of doing java. Dropping them, with an alias for the old names for backward
compatability.
---
 stem/control.py |1 +
 stem/util/proc.py   |   50 ++--
 test/integ/util/proc.py |   32 
 test/unit/util/proc.py  |   64 +++
 4 files changed, 80 insertions(+), 67 deletions(-)

diff --git a/stem/control.py b/stem/control.py
index 8571a7f..7c5d7bd 100644
--- a/stem/control.py
+++ b/stem/control.py
@@ -128,6 +128,7 @@ If you're fine with allowing your script to raise 
exceptions then this can be mo
   BaseController - Base controller class asynchronous message handling
 |- msg - communicates with the tor process
 |- is_alive - reports if our connection to tor is open or closed
+|- connection_time - time when we last connected or disconnected
 |- is_authenticated - checks if we're authenticated to tor
 |- connect - connects or reconnects to tor
 |- close - shuts down our connection to the tor process
diff --git a/stem/util/proc.py b/stem/util/proc.py
index f9b2a59..ac1f6f6 100644
--- a/stem/util/proc.py
+++ b/stem/util/proc.py
@@ -20,18 +20,18 @@ future, use them at your own risk.**
 ::
 
   is_available - checks if proc utilities can be used on this system
-  get_system_start_time - unix timestamp for when the system started
-  get_physical_memory - memory available on this system
-  get_cwd - provides the current working directory for a process
-  get_uid - provides the user id a process is running under
-  get_memory_usage - provides the memory usage of a process
-  get_stats - queries statistics about a process
-  get_file_descriptors_used - number of file descriptors used by a process
-  get_connections - provides the connections made by a process
+  system_start_time - unix timestamp for when the system started
+  physical_memory - memory available on this system
+  cwd - provides the current working directory for a process
+  uid - provides the user id a process is running under
+  memory_usage - provides the memory usage of a process
+  stats - queries statistics about a process
+  file_descriptors_used - number of file descriptors used by a process
+  connections - provides the connections made by a process
 
 .. data:: Stat (enum)
 
-  Types of data available via the :func:`~stem.util.proc.get_stats` function.
+  Types of data available via the :func:`~stem.util.proc.stats` function.
 
   == ===
   Stat   Description
@@ -94,7 +94,7 @@ def is_available():
 
 
 @lru_cache()
-def get_system_start_time():
+def system_start_time():
   
   Provides the unix time (seconds since epoch) when the system started.
 
@@ -117,7 +117,7 @@ def get_system_start_time():
 
 
 @lru_cache()
-def get_physical_memory():
+def physical_memory():
   
   Provides the total physical memory on the system in bytes.
 
@@ -139,7 +139,7 @@ def get_physical_memory():
 raise exc
 
 
-def get_cwd(pid):
+def cwd(pid):
   
   Provides the current working directory for the given process.
 
@@ -167,7 +167,7 @@ def get_cwd(pid):
   return cwd
 
 
-def get_uid(pid):
+def uid(pid):
   
   Provides the user ID the given process is running under.
 
@@ -192,7 +192,7 @@ def get_uid(pid):
 raise exc
 
 
-def get_memory_usage(pid):
+def memory_usage(pid):
   
   Provides the memory usage in bytes for the given process.
 
@@ -225,7 +225,7 @@ def get_memory_usage(pid):
 raise exc
 
 
-def get_stats(pid, *stat_types):
+def stats(pid, *stat_types):
   
   Provides process specific information. See the :data:`~stem.util.proc.Stat`
   enum for valid options.
@@ -281,19 +281,19 @@ def get_stats(pid, *stat_types):
 results.append(str(float(stat_comp[14]) / CLOCK_TICKS))
 elif stat_type == Stat.START_TIME:
   if pid == 0:
-return get_system_start_time()
+return system_start_time()
   else:
 # According to documentation, starttime is in field 21 and the unit is
 # jiffies (clock ticks). We divide it for clock ticks, then add the
 # uptime to get the seconds since the epoch.
 p_start_time = float(stat_comp[21]) / CLOCK_TICKS
-results.append(str(p_start_time + get_system_start_time()))
+results.append(str(p_start_time + system_start_time()))
 
   _log_runtime(parameter, stat_path, start_time)
   return tuple(results)
 
 
-def get_file_descriptors_used(pid):
+def file_descriptors_used(pid):
   
   Provides the number of file descriptors currently being used by a process.
 
@@ -318,7 +318,7 @@ def get_file_descriptors_used(pid):
 raise IOError(Unable to check number of file descriptors used: %s % exc)
 
 
-def get_connections(pid):
+def 

[tor-commits] [stem/master] Renaming get_system_resolvers() to system_resolvers()

2014-09-01 Thread atagar
commit abe6fc9d9caee79bcb3021d9942204e3ce63c54b
Author: Damian Johnson ata...@torproject.org
Date:   Mon Sep 1 20:24:41 2014 -0700

Renaming get_system_resolvers() to system_resolvers()
---
 docs/tutorials/east_of_the_sun.rst |4 ++--
 stem/util/connection.py|   18 +++---
 stem/util/proc.py  |5 ++---
 stem/util/system.py|5 ++---
 test/integ/util/connection.py  |4 ++--
 test/unit/util/connection.py   |   20 ++--
 6 files changed, 33 insertions(+), 23 deletions(-)

diff --git a/docs/tutorials/east_of_the_sun.rst 
b/docs/tutorials/east_of_the_sun.rst
index fa7635b..13ede2d 100644
--- a/docs/tutorials/east_of_the_sun.rst
+++ b/docs/tutorials/east_of_the_sun.rst
@@ -37,10 +37,10 @@ simple script that dumps Tor's present connections.
 
   import sys 
 
-  from stem.util.connection import get_connections, get_system_resolvers
+  from stem.util.connection import get_connections, system_resolvers
   from stem.util.system import pid_by_name
 
-  resolvers = get_system_resolvers()
+  resolvers = system_resolvers()
 
   if not resolvers:
 print Stem doesn't support any connection resolvers on our platform.
diff --git a/stem/util/connection.py b/stem/util/connection.py
index 0c5b744..09acdeb 100644
--- a/stem/util/connection.py
+++ b/stem/util/connection.py
@@ -4,10 +4,12 @@
 
 Connection and networking based utility functions.
 
+**Module Overview:**
+
 ::
 
   get_connections - quieries the connections belonging to a given process
-  get_system_resolvers - provides connection resolution methods that are 
likely to be available
+  system_resolvers - provides connection resolution methods that are likely to 
be available
   port_usage - brief description of the common usage for a port
 
   is_valid_ipv4_address - checks if a string is a valid IPv4 address
@@ -130,7 +132,7 @@ RESOLVER_FILTER = {
 def get_connections(resolver, process_pid = None, process_name = None):
   
   Retrieves a list of the current connections for a given process. The provides
-  a list of Connection instances, which have four attributes...
+  a list of Connection instances, which have five attributes...
 
 * local_address (str)
 * local_port (int)
@@ -230,12 +232,16 @@ def get_connections(resolver, process_pid = None, 
process_name = None):
   return connections
 
 
-def get_system_resolvers(system = None):
+def system_resolvers(system = None):
   
   Provides the types of connection resolvers likely to be available on this 
platform.
 
   .. versionadded:: 1.1.0
 
+  .. versionchanged:: 1.3.0
+ Renamed from get_system_resolvers() to system_resolvers(). The old name
+ still works as an alias, but will be dropped in Stem version 2.0.0.
+
   :param str system: system to get resolvers for, this is determined by
 platform.system() if not provided
 
@@ -619,3 +625,9 @@ def _cryptovariables_equal(x, y):
   return (
 _hmac_sha256(CRYPTOVARIABLE_EQUALITY_COMPARISON_NONCE, x) ==
 _hmac_sha256(CRYPTOVARIABLE_EQUALITY_COMPARISON_NONCE, y))
+
+# TODO: drop with stem 2.x
+# We renamed our methods to drop a redundant 'get_*' prefix, so alias the old
+# names for backward compatability.
+
+get_system_resolvers = system_resolvers
diff --git a/stem/util/proc.py b/stem/util/proc.py
index b05d283..85a7501 100644
--- a/stem/util/proc.py
+++ b/stem/util/proc.py
@@ -15,9 +15,8 @@ Dave Daeschler, Giampaolo Rodola' and is under the BSD 
license.
 **These functions are not being vended to stem users. They may change in the
 future, use them at your own risk.**
 
-.. deprecated:: 1.3.0
-   Many functions were previously named with a get_* prefix. Those names are
-   now aliases, and will be dropped in Stem version 2.0.0.
+**Note:** Many functions were previously named with a get_* prefix. Those names
+are now aliases, and will be dropped in Stem version 2.0.0.
 
 **Module Overview:**
 
diff --git a/stem/util/system.py b/stem/util/system.py
index 89eac3f..47023f4 100644
--- a/stem/util/system.py
+++ b/stem/util/system.py
@@ -6,9 +6,8 @@ Helper functions for working with the underlying system. These 
are mostly os
 dependent, only working on linux, osx, and bsd. In almost all cases they're
 best-effort, providing **None** if the lookup fails.
 
-.. deprecated:: 1.3.0
-   Many functions were previously named with a get_* prefix. Those names are
-   now aliases, and will be dropped in Stem version 2.0.0.
+**Note:** Many functions were previously named with a get_* prefix. Those names
+are now aliases, and will be dropped in Stem version 2.0.0.
 
 **Module Overview:**
 
diff --git a/test/integ/util/connection.py b/test/integ/util/connection.py
index 8883be2..589026a 100644
--- a/test/integ/util/connection.py
+++ b/test/integ/util/connection.py
@@ -7,7 +7,7 @@ import unittest
 
 import test.runner
 
-from stem.util.connection import get_connections, get_system_resolvers
+from stem.util.connection import get_connections, system_resolvers
 
 
 class 

[tor-commits] [stem/master] Dropping get_* prefix from most util functions

2014-09-01 Thread atagar
commit 886b8e564aa9d4795ca915949a1004106efa4be0
Merge: 20d7f9d 611ecdb
Author: Damian Johnson ata...@torproject.org
Date:   Mon Sep 1 20:50:07 2014 -0700

Dropping get_* prefix from most util functions

Bad habbit from my java days. The get_* prefix for these function names 
didn't
add anything, they were just bloat. The old function names are aliases for 
the
new ones so no worries about backward compatability.

 docs/change_log.rst  |   10 +-
 docs/tutorials/east_of_the_sun.rst   |8 +-
 docs/tutorials/mirror_mirror_on_the_wall.rst |2 +-
 docs/tutorials/tortoise_and_the_hare.rst |4 +-
 run_tests.py |4 +-
 stem/connection.py   |   14 +--
 stem/control.py  |9 +-
 stem/util/connection.py  |   20 +++-
 stem/util/proc.py|   53 ++
 stem/util/str_tools.py   |   48 +
 stem/util/system.py  |   66 +++-
 stem/util/test_tools.py  |   25 -
 test/integ/util/connection.py|4 +-
 test/integ/util/proc.py  |   32 +++---
 test/integ/util/system.py|  142 +-
 test/unit/control/controller.py  |6 +-
 test/unit/doctest.py |8 +-
 test/unit/response/protocolinfo.py   |2 +-
 test/unit/tutorial.py|2 +-
 test/unit/util/connection.py |   22 ++--
 test/unit/util/proc.py   |   64 ++--
 test/unit/util/str_tools.py  |   82 +++
 test/unit/util/system.py |  120 +++---
 23 files changed, 410 insertions(+), 337 deletions(-)

___
tor-commits mailing list
tor-commits@lists.torproject.org
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits


[tor-commits] [stem/master] Dropping get_* prefix from system functions

2014-09-01 Thread atagar
commit 87f9549091d4050578b963238179a584b2936491
Author: Damian Johnson ata...@torproject.org
Date:   Mon Sep 1 18:02:49 2014 -0700

Dropping get_* prefix from system functions
---
 docs/change_log.rst|   10 +--
 docs/tutorials/east_of_the_sun.rst |4 +-
 stem/connection.py |   14 ++--
 stem/control.py|8 +-
 stem/util/connection.py|2 +-
 stem/util/proc.py  |4 +
 stem/util/system.py|   67 +++--
 test/integ/util/system.py  |  142 ++--
 test/unit/control/controller.py|6 +-
 test/unit/response/protocolinfo.py |2 +-
 test/unit/util/connection.py   |2 +-
 test/unit/util/system.py   |  120 +++---
 12 files changed, 202 insertions(+), 179 deletions(-)

diff --git a/docs/change_log.rst b/docs/change_log.rst
index 24e39f0..dbb5581 100644
--- a/docs/change_log.rst
+++ b/docs/change_log.rst
@@ -147,12 +147,12 @@ and a myriad of smaller improvements and fixes.
 
   * Connection resolution via the 
:func:`~stem.util.connection.get_connections` function (:trac:`7910`)
   * :func:`~stem.util.system.set_process_name` inserted spaces between 
characters (:trac:`8631`)
-  * :func:`~stem.util.system.get_pid_by_name` can now pull for all processes 
with a given name
+  * :func:`~stem.util.system.pid_by_name` can now pull for all processes with 
a given name
   * :func:`~stem.util.system.call` ignored the subprocess' exit status
-  * Added :func:`stem.util.system.get_name_by_pid`
-  * Added :func:`stem.util.system.get_user`
-  * Added :func:`stem.util.system.get_start_time`
-  * Added :func:`stem.util.system.get_bsd_jail_path`
+  * Added :func:`stem.util.system.name_by_pid`
+  * Added :func:`stem.util.system.user`
+  * Added :func:`stem.util.system.start_time`
+  * Added :func:`stem.util.system.bsd_jail_path`
   * Added :func:`stem.util.system.is_tarfile`
   * Added :func:`stem.util.connection.is_private_address`
 
diff --git a/docs/tutorials/east_of_the_sun.rst 
b/docs/tutorials/east_of_the_sun.rst
index 374275e..fa7635b 100644
--- a/docs/tutorials/east_of_the_sun.rst
+++ b/docs/tutorials/east_of_the_sun.rst
@@ -38,7 +38,7 @@ simple script that dumps Tor's present connections.
   import sys 
 
   from stem.util.connection import get_connections, get_system_resolvers
-  from stem.util.system import get_pid_by_name
+  from stem.util.system import pid_by_name
 
   resolvers = get_system_resolvers()
 
@@ -49,7 +49,7 @@ simple script that dumps Tor's present connections.
   picked_resolver = resolvers[0]  # lets just opt for the first
   print Our platform supports connection resolution via: %s (picked %s) % 
(', '.join(resolvers), picked_resolver)
 
-  tor_pids = get_pid_by_name('tor', multiple = True)
+  tor_pids = pid_by_name('tor', multiple = True)
 
   if not tor_pids:
 print Unable to get tor's pid. Is it running?
diff --git a/stem/connection.py b/stem/connection.py
index cc28fa5..a38422b 100644
--- a/stem/connection.py
+++ b/stem/connection.py
@@ -1012,7 +1012,7 @@ def get_protocolinfo(controller):
   # attempt to expand relative cookie paths
 
   if protocolinfo_response.cookie_path:
-_expand_cookie_path(protocolinfo_response, 
stem.util.system.get_pid_by_name, 'tor')
+_expand_cookie_path(protocolinfo_response, stem.util.system.pid_by_name, 
'tor')
 
   # attempt to expand relative cookie paths via the control port or socket file
 
@@ -1023,10 +1023,10 @@ def get_protocolinfo(controller):
 
   if isinstance(control_socket, stem.socket.ControlPort):
 if control_socket.get_address() == '127.0.0.1':
-  pid_method = stem.util.system.get_pid_by_port
+  pid_method = stem.util.system.pid_by_port
   _expand_cookie_path(protocolinfo_response, pid_method, 
control_socket.get_port())
   elif isinstance(control_socket, stem.socket.ControlSocketFile):
-pid_method = stem.util.system.get_pid_by_open_file
+pid_method = stem.util.system.pid_by_open_file
 _expand_cookie_path(protocolinfo_response, pid_method, 
control_socket.get_socket_path())
 
   return protocolinfo_response
@@ -1102,7 +1102,7 @@ def _expand_cookie_path(protocolinfo_response, 
pid_resolver, pid_resolution_arg)
   if not tor_pid:
 raise IOError('pid lookup failed')
 
-  tor_cwd = stem.util.system.get_cwd(tor_pid)
+  tor_cwd = stem.util.system.cwd(tor_pid)
 
   if not tor_cwd:
 raise IOError('cwd lookup failed')
@@ -1110,9 +1110,9 @@ def _expand_cookie_path(protocolinfo_response, 
pid_resolver, pid_resolution_arg)
   cookie_path = stem.util.system.expand_path(cookie_path, tor_cwd)
 except IOError as exc:
   resolver_labels = {
-stem.util.system.get_pid_by_name: ' by name',
-stem.util.system.get_pid_by_port: ' by port',
-stem.util.system.get_pid_by_open_file: ' by socket file',
+stem.util.system.pid_by_name: ' by name',
+

[tor-commits] [stem/master] Dropping get_* prefix from testing functions

2014-09-01 Thread atagar
commit 611ecdbcaea03d28564dcce5129366e9e90d4813
Author: Damian Johnson ata...@torproject.org
Date:   Mon Sep 1 20:41:05 2014 -0700

Dropping get_* prefix from testing functions
---
 run_tests.py|4 ++--
 stem/util/test_tools.py |   25 -
 2 files changed, 22 insertions(+), 7 deletions(-)

diff --git a/run_tests.py b/run_tests.py
index 2d73457..2a541cf 100755
--- a/run_tests.py
+++ b/run_tests.py
@@ -91,7 +91,7 @@ https://pypi.python.org/pypi/mock/
 
 PYFLAKES_TASK = Task(
   running pyflakes,
-  stem.util.test_tools.get_pyflakes_issues,
+  stem.util.test_tools.pyflakes_issues,
   args = (SRC_PATHS,),
   is_required = False,
   print_result = False,
@@ -99,7 +99,7 @@ PYFLAKES_TASK = Task(
 
 PEP8_TASK = Task(
   running pep8,
-  stem.util.test_tools.get_stylistic_issues,
+  stem.util.test_tools.stylistic_issues,
   args = (SRC_PATHS, True, True, True, True),
   is_required = False,
   print_result = False,
diff --git a/stem/util/test_tools.py b/stem/util/test_tools.py
index ba6392d..8209c58 100644
--- a/stem/util/test_tools.py
+++ b/stem/util/test_tools.py
@@ -13,8 +13,8 @@ Helper functions for testing.
   is_pyflakes_available - checks if pyflakes is available
   is_pep8_available - checks if pep8 is available
 
-  get_stylistic_issues - checks for PEP8 and other stylistic issues
-  get_pyflakes_issues - static checks for problems via pyflakes
+  stylistic_issues - checks for PEP8 and other stylistic issues
+  pyflakes_issues - static checks for problems via pyflakes
 
 
 import os
@@ -103,7 +103,7 @@ def is_pep8_available():
 return False
 
 
-def get_stylistic_issues(paths, check_two_space_indents = False, 
check_newlines = False, check_trailing_whitespace = False, 
check_exception_keyword = False):
+def stylistic_issues(paths, check_two_space_indents = False, check_newlines = 
False, check_trailing_whitespace = False, check_exception_keyword = False):
   
   Checks for stylistic issues that are an issue according to the parts of PEP8
   we conform to. You can suppress PEP8 issues by making a 'test' configuration
@@ -131,11 +131,15 @@ def get_stylistic_issues(paths, check_two_space_indents = 
False, check_newlines
 test_config = stem.util.conf.get_config('test')
 test_config.load('test/settings.cfg')
 
-issues = get_stylistic_issues('my_project')
+issues = stylistic_issues('my_project')
 
   If a 'exclude_paths' was set in our test config then we exclude any absolute
   paths matching those regexes.
 
+  .. versionchanged:: 1.3.0
+ Renamed from get_stylistic_issues() to stylistic_issues(). The old name
+ still works as an alias, but will be dropped in Stem version 2.0.0.
+
   :param list paths: paths to search for stylistic issues
   :param bool check_two_space_indents: check for two space indentations and
 that no tabs snuck in
@@ -209,7 +213,7 @@ def get_stylistic_issues(paths, check_two_space_indents = 
False, check_newlines
   return issues
 
 
-def get_pyflakes_issues(paths):
+def pyflakes_issues(paths):
   
   Performs static checks via pyflakes. False positives can be ignored via
   'pyflakes.ignore' entries in our 'test' config. For instance...
@@ -222,6 +226,10 @@ def get_pyflakes_issues(paths):
   If a 'exclude_paths' was set in our test config then we exclude any absolute
   paths matching those regexes.
 
+  .. versionchanged:: 1.3.0
+ Renamed from get_pyflakes_issues() to pyflakes_issues(). The old name
+ still works as an alias, but will be dropped in Stem version 2.0.0.
+
   :param list paths: paths to search for problems
 
   :returns: dict of the form ``path = [(line_number, message)...]``
@@ -284,3 +292,10 @@ def _python_files(paths):
 
   if not skip:
 yield file_path
+
+# TODO: drop with stem 2.x
+# We renamed our methods to drop a redundant 'get_*' prefix, so alias the old
+# names for backward compatability.
+
+get_stylistic_issues = stylistic_issues
+get_pyflakes_issues = pyflakes_issues



___
tor-commits mailing list
tor-commits@lists.torproject.org
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits


[tor-commits] [arm/master] Dropping the pad_str() function

2014-09-01 Thread atagar
commit 730051edd9a3c357eb81c3ebc3d5b9e490e1d9fe
Author: Damian Johnson ata...@torproject.org
Date:   Mon Sep 1 20:53:07 2014 -0700

Dropping the pad_str() function

Turns out it's unused. If it wasn't then the buildin str's ljust does the 
exact
same thing. :)
---
 arm/util/ui_tools.py |   16 
 1 file changed, 16 deletions(-)

diff --git a/arm/util/ui_tools.py b/arm/util/ui_tools.py
index cfa6ba3..d2a6f43 100644
--- a/arm/util/ui_tools.py
+++ b/arm/util/ui_tools.py
@@ -181,22 +181,6 @@ def get_printable(line, keep_newlines = True):
   return line
 
 
-def pad_str(msg, size, crop_extra = False):
-  
-  Provides the string padded with whitespace to the given length.
-
-  Arguments:
-msg   - string to be padded
-size  - length to be padded to
-crop_extra - crops string if it's longer than the size if true
-  
-
-  if crop_extra:
-msg = msg[:size]
-
-  return (%%-%is % size) % msg
-
-
 def draw_box(panel, top, left, width, height, attr=curses.A_NORMAL):
   
   Draws a box in the panel with the given bounds.



___
tor-commits mailing list
tor-commits@lists.torproject.org
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits


[tor-commits] [arm/master] Adding an is_wide() helper for the header panel

2014-09-01 Thread atagar
commit 308a213009f43588a34c5b44d87de8d467ce9efe
Author: Damian Johnson ata...@torproject.org
Date:   Mon Sep 1 17:31:58 2014 -0700

Adding an is_wide() helper for the header panel

Three things make decisions based on if we're showing two columns or not, so
adding a helper to answer it.
---
 arm/header_panel.py |   22 ++
 1 file changed, 14 insertions(+), 8 deletions(-)

diff --git a/arm/header_panel.py b/arm/header_panel.py
index 6e1f381..c0ab850 100644
--- a/arm/header_panel.py
+++ b/arm/header_panel.py
@@ -51,18 +51,26 @@ class HeaderPanel(panel.Panel, threading.Thread):
 
 tor_controller().add_status_listener(self.reset_listener)
 
+  def is_wide(self, width = None):
+
+True if we should show two columns of information, False otherwise.
+
+
+if width is None:
+  width = self.get_parent().getmaxyx()[1]
+
+return width = MIN_DUAL_COL_WIDTH
+
   def get_height(self):
 
 Provides the height of the content, which is dynamically determined by the
 panel's maximum width.
 
 
-is_wide = self.get_parent().getmaxyx()[1] = MIN_DUAL_COL_WIDTH
-
 if self._vals.is_relay:
-  return 4 if is_wide else 6
+  return 4 if self.is_wide() else 6
 else:
-  return 3 if is_wide else 4
+  return 3 if self.is_wide() else 4
 
   def send_newnym(self):
 
@@ -74,9 +82,7 @@ class HeaderPanel(panel.Panel, threading.Thread):
 # If we're wide then the newnym label in this panel will give an
 # indication that the signal was sent. Otherwise use a msg.
 
-is_wide = self.get_parent().getmaxyx()[1] = MIN_DUAL_COL_WIDTH
-
-if not is_wide:
+if not self.is_wide():
   arm.popups.show_msg('Requesting a new identity', 1)
 
   def handle_key(self, key):
@@ -134,7 +140,7 @@ class HeaderPanel(panel.Panel, threading.Thread):
 
   def draw(self, width, height):
 vals = self._vals  # local reference to avoid concurrency concerns
-is_wide = width + 1 = MIN_DUAL_COL_WIDTH
+is_wide = self.is_wide(width)
 
 # space available for content
 



___
tor-commits mailing list
tor-commits@lists.torproject.org
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits


[tor-commits] [stem/master] Dropping get_* prefix from string util functions

2014-09-01 Thread atagar
commit 7fc393595e9ee2e13283886df609402e9ed9bbfa
Author: Damian Johnson ata...@torproject.org
Date:   Mon Sep 1 20:33:30 2014 -0700

Dropping get_* prefix from string util functions
---
 docs/tutorials/mirror_mirror_on_the_wall.rst |2 +-
 docs/tutorials/tortoise_and_the_hare.rst |4 +-
 stem/util/str_tools.py   |   48 +--
 test/unit/doctest.py |8 +--
 test/unit/tutorial.py|2 +-
 test/unit/util/str_tools.py  |   82 +-
 6 files changed, 79 insertions(+), 67 deletions(-)

diff --git a/docs/tutorials/mirror_mirror_on_the_wall.rst 
b/docs/tutorials/mirror_mirror_on_the_wall.rst
index 0db54c3..8fc196b 100644
--- a/docs/tutorials/mirror_mirror_on_the_wall.rst
+++ b/docs/tutorials/mirror_mirror_on_the_wall.rst
@@ -186,7 +186,7 @@ could use any of the methods above, but for this example 
we'll use
 
   for bw_value in sorted(bw_to_relay.keys(), reverse = True):
 for nickname in bw_to_relay[bw_value]:
-  print %i. %s (%s/s) % (count, nickname, 
str_tools.get_size_label(bw_value, 2))
+  print %i. %s (%s/s) % (count, nickname, str_tools.size_label(bw_value, 
2))
   count += 1
 
   if count  15:
diff --git a/docs/tutorials/tortoise_and_the_hare.rst 
b/docs/tutorials/tortoise_and_the_hare.rst
index a458e0d..d3f759e 100644
--- a/docs/tutorials/tortoise_and_the_hare.rst
+++ b/docs/tutorials/tortoise_and_the_hare.rst
@@ -107,10 +107,10 @@ uploaded.
 
 # show the latest values at the top
 
-label = Downloaded (%s/s): % str_tools.get_size_label(download_rates[0], 
1)
+label = Downloaded (%s/s): % str_tools.size_label(download_rates[0], 1)
 window.addstr(0, 1, label, DOWNLOAD_COLOR, curses.A_BOLD)
 
-label = Uploaded (%s/s): % str_tools.get_size_label(upload_rates[0], 1)
+label = Uploaded (%s/s): % str_tools.size_label(upload_rates[0], 1)
 window.addstr(0, GRAPH_WIDTH + 7, label, UPLOAD_COLOR, curses.A_BOLD)
 
 # draw the graph bounds in KB
diff --git a/stem/util/str_tools.py b/stem/util/str_tools.py
index e166a4c..4bba8e3 100644
--- a/stem/util/str_tools.py
+++ b/stem/util/str_tools.py
@@ -4,16 +4,19 @@
 
 Toolkit for various string activity.
 
+**Note:** Many functions were previously named with a get_* prefix. Those names
+are now aliases, and will be dropped in Stem version 2.0.0.
+
 **Module Overview:**
 
 ::
 
   crop - shortens string to a given length
 
-  get_size_label - human readable label for a number of bytes
-  get_time_label - human readable label for a number of seconds
-  get_time_labels - human readable labels for each time unit
-  get_short_time_label - condensed time label output
+  size_label - human readable label for a number of bytes
+  time_label - human readable label for a number of seconds
+  time_labels - human readable labels for each time unit
+  short_time_label - condensed time label output
   parse_short_time_label - seconds represented by a short time label
 
 
@@ -251,7 +254,7 @@ def crop(msg, size, min_word_length = 4, min_crop = 0, 
ending = Ending.ELLIPSE,
   return (return_msg, remainder) if get_remainder else return_msg
 
 
-def get_size_label(byte_count, decimal = 0, is_long = False, is_bytes = True):
+def size_label(byte_count, decimal = 0, is_long = False, is_bytes = True):
   
   Converts a number of bytes into a human readable label in its most
   significant units. For instance, 7500 bytes would return 7 KB. If the
@@ -261,13 +264,13 @@ def get_size_label(byte_count, decimal = 0, is_long = 
False, is_bytes = True):
 
   ::
 
- get_size_label(200)
+ size_label(200)
 '1 MB'
 
- get_size_label(1050, 2)
+ size_label(1050, 2)
 '1.02 KB'
 
- get_size_label(1050, 3, True)
+ size_label(1050, 3, True)
 '1.025 Kilobytes'
 
   :param int byte_count: number of bytes to be converted
@@ -284,7 +287,7 @@ def get_size_label(byte_count, decimal = 0, is_long = 
False, is_bytes = True):
 return _get_label(SIZE_UNITS_BITS, byte_count, decimal, is_long)
 
 
-def get_time_label(seconds, decimal = 0, is_long = False):
+def time_label(seconds, decimal = 0, is_long = False):
   
   Converts seconds into a time label truncated to its most significant units.
   For instance, 7500 seconds would return 2h. Units go up through days.
@@ -296,13 +299,13 @@ def get_time_label(seconds, decimal = 0, is_long = False):
 
   ::
 
- get_time_label(1)
+ time_label(1)
 '2h'
 
- get_time_label(61, 1, True)
+ time_label(61, 1, True)
 '1.0 minute'
 
- get_time_label(61, 2, True)
+ time_label(61, 2, True)
 '1.01 minutes'
 
   :param int seconds: number of seconds to be converted
@@ -315,7 +318,7 @@ def get_time_label(seconds, decimal = 0, is_long = False):
   return _get_label(TIME_UNITS, seconds, decimal, is_long)
 
 
-def get_time_labels(seconds, is_long = False):
+def time_labels(seconds, is_long = False):
   
   Provides a list of label 

[tor-commits] [stem/master] Adding proc.get_file_descriptors_used

2014-09-01 Thread atagar
commit 20d7f9d13cbc183d33a129324137b06d2aaeb313
Author: Damian Johnson ata...@torproject.org
Date:   Mon Sep 1 15:43:39 2014 -0700

Adding proc.get_file_descriptors_used

Just a little helper for getting the number of file descriptors a process is
using.
---
 docs/change_log.rst|1 +
 stem/util/proc.py  |   38 +-
 test/unit/util/proc.py |   31 +++
 3 files changed, 65 insertions(+), 5 deletions(-)

diff --git a/docs/change_log.rst b/docs/change_log.rst
index 2b6964c..24e39f0 100644
--- a/docs/change_log.rst
+++ b/docs/change_log.rst
@@ -54,6 +54,7 @@ The following are only available within Stem's `git repository
   * Added support for directories to :func:`stem.util.conf.Config.load`.
   * Changed :func:`stem.util.conf.uses_settings` to only provide a 'config' 
keyword arument if the decorated function would accept it.
   * Added :func:`stem.util.str_tools.crop`
+  * Added :func:`stem.util.proc.get_file_descriptors_used`
 
  * **Interpreter**
 
diff --git a/stem/util/proc.py b/stem/util/proc.py
index 62b7a5e..f9b2a59 100644
--- a/stem/util/proc.py
+++ b/stem/util/proc.py
@@ -26,6 +26,7 @@ future, use them at your own risk.**
   get_uid - provides the user id a process is running under
   get_memory_usage - provides the memory usage of a process
   get_stats - queries statistics about a process
+  get_file_descriptors_used - number of file descriptors used by a process
   get_connections - provides the connections made by a process
 
 .. data:: Stat (enum)
@@ -292,6 +293,31 @@ def get_stats(pid, *stat_types):
   return tuple(results)
 
 
+def get_file_descriptors_used(pid):
+  
+  Provides the number of file descriptors currently being used by a process.
+
+  :param int pid: process id of the process to be queried
+
+  :returns: **int** of the number of file descriptors used
+
+  :raises: **IOError** if it can't be determined
+  
+
+  try:
+pid = int(pid)
+
+if pid  0:
+  raise IOError(Process pids can't be negative: %s % pid)
+  except (ValueError, TypeError):
+raise IOError('Process pid was non-numeric: %s' % pid)
+
+  try:
+return len(os.listdir('/proc/%i/fd' % pid))
+  except Exception as exc:
+raise IOError(Unable to check number of file descriptors used: %s % exc)
+
+
 def get_connections(pid):
   
   Queries connection related information from the proc contents. This provides
@@ -307,11 +333,13 @@ def get_connections(pid):
   :raises: **IOError** if it can't be determined
   
 
-  if isinstance(pid, str):
-try:
-  pid = int(pid)
-except ValueError:
-  raise IOError('Process pid was non-numeric: %s' % pid)
+  try:
+pid = int(pid)
+
+if pid  0:
+  raise IOError(Process pids can't be negative: %s % pid)
+  except (ValueError, TypeError):
+raise IOError('Process pid was non-numeric: %s' % pid)
 
   if pid == 0:
 return []
diff --git a/test/unit/util/proc.py b/test/unit/util/proc.py
index c682853..1786a99 100644
--- a/test/unit/util/proc.py
+++ b/test/unit/util/proc.py
@@ -144,6 +144,37 @@ class TestProc(unittest.TestCase):
   self.assertEquals(response, proc.get_stats(0, *args))
 
   @patch('os.listdir')
+  def test_get_file_descriptors_used(self, listdir_mock):
+
+Tests the get_file_descriptors_used function.
+
+
+# check that we reject bad pids
+
+for arg in (None, -100, 'hello',):
+  self.assertRaises(IOError, proc.get_file_descriptors_used, arg)
+
+# when proc directory doesn't exist
+
+error_msg = OSError: [Errno 2] No such file or directory: '/proc/2118/fd'
+listdir_mock.side_effect = OSError(error_msg)
+
+try:
+  proc.get_file_descriptors_used(2118)
+  self.fail(We should raise when listdir() fails)
+except IOError as exc:
+  expected = Unable to check number of file descriptors used: %s % 
error_msg
+  self.assertEqual(expected, str(exc))
+
+# successful calls
+
+listdir_mock.return_value = ['0', '1', '2', '3', '4', '5']
+listdir_mock.side_effect = None
+
+self.assertEqual(6, proc.get_file_descriptors_used(2118))
+self.assertEqual(6, proc.get_file_descriptors_used('2118'))
+
+  @patch('os.listdir')
   @patch('os.readlink')
   @patch('stem.util.proc.open', create = True)
   def test_get_connections(self, open_mock, readlink_mock, listdir_mock):



___
tor-commits mailing list
tor-commits@lists.torproject.org
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits


[tor-commits] [arm/master] Dropping header panel's _get_fd_used()

2014-09-01 Thread atagar
commit de0f54cf1f9dc616bf712a52deead610220d0964
Author: Damian Johnson ata...@torproject.org
Date:   Mon Sep 1 15:45:59 2014 -0700

Dropping header panel's _get_fd_used()

Removing one of the header panel's helper functions now that it's in stem.
---
 arm/header_panel.py |   92 +--
 arm/util/tracker.py |6 ++--
 2 files changed, 34 insertions(+), 64 deletions(-)

diff --git a/arm/header_panel.py b/arm/header_panel.py
index cd037a1..2371667 100644
--- a/arm/header_panel.py
+++ b/arm/header_panel.py
@@ -51,7 +51,7 @@ class HeaderPanel(panel.Panel, threading.Thread):
 self._is_fd_sixty_percent_warned = False
 self._is_fd_ninety_percent_warned = False
 
-self.vals = Sampling()
+self._vals = Sampling()
 
 # listens for tor reload (sighup) events
 
@@ -65,7 +65,7 @@ class HeaderPanel(panel.Panel, threading.Thread):
 
 is_wide = self.get_parent().getmaxyx()[1] = MIN_DUAL_COL_WIDTH
 
-if self.vals.is_relay:
+if self._vals.is_relay:
   return 4 if is_wide else 6
 else:
   return 3 if is_wide else 4
@@ -90,7 +90,7 @@ class HeaderPanel(panel.Panel, threading.Thread):
 
 if key in (ord('n'), ord('N')) and tor_controller().is_newnym_available():
   self.send_newnym()
-elif key in (ord('r'), ord('R')) and not self.vals.is_connected:
+elif key in (ord('r'), ord('R')) and not self._vals.is_connected:
   # oldSocket = tor_tools.get_conn().get_controller().get_socket()
   #
   # controller = None
@@ -139,7 +139,7 @@ class HeaderPanel(panel.Panel, threading.Thread):
 return is_keystroke_consumed
 
   def draw(self, width, height):
-vals = self.vals  # local reference to avoid concurrency concerns
+vals = self._vals  # local reference to avoid concurrency concerns
 is_wide = width + 1 = MIN_DUAL_COL_WIDTH
 
 # space available for content
@@ -304,7 +304,7 @@ class HeaderPanel(panel.Panel, threading.Thread):
 
 x = self.addstr(y, x, 'flags: ')
 
-if len(vals.flags)  0:
+if vals.flags:
   for i, flag in enumerate(vals.flags):
 flag_color = CONFIG['attr.flag_colors'].get(flag, 'white')
 x = self.addstr(y, x, flag, curses.A_BOLD, flag_color)
@@ -344,13 +344,11 @@ class HeaderPanel(panel.Panel, threading.Thread):
 available if in the process of building circuits.
 
 
-newnym_wait = tor_controller().get_newnym_wait()
-
-if newnym_wait == 0:
+if vals.newnym_wait == 0:
   self.addstr(y, x, press 'n' for a new identity)
 else:
-  plural = 's' if newnym_wait  1 else ''
-  self.addstr(y, x, 'building circuits, available again in %i second%s' % 
(newnym_wait, plural))
+  plural = 's' if vals.newnym_wait  1 else ''
+  self.addstr(y, x, 'building circuits, available again in %i second%s' % 
(vals.newnym_wait, plural))
 
   def run(self):
 
@@ -362,7 +360,7 @@ class HeaderPanel(panel.Panel, threading.Thread):
 while not self._halt:
   current_time = time.time()
 
-  if self.is_paused() or current_time - last_draw  1 or not 
self.vals.is_connected:
+  if self.is_paused() or current_time - last_draw  1 or not 
self._vals.is_connected:
 self._cond.acquire()
 
 if not self._halt:
@@ -379,16 +377,16 @@ class HeaderPanel(panel.Panel, threading.Thread):
 
 is_changed = False
 
-if self.vals.pid:
+if self._vals.pid:
   # resource_tracker = arm.util.tracker.get_resource_tracker()
   # is_changed = self._last_resource_fetch != 
resource_tracker.run_counter()
   is_changed = True  # TODO: we should decide to redraw or not based 
on if the sampling values have changed
 
-if is_changed or (self.vals and current_time - self.vals.retrieved = 
20):
-  self.vals = Sampling(self.vals)
+if is_changed or (self._vals and current_time - self._vals.retrieved 
= 20):
+  self._vals = Sampling(self._vals)
 
-  if self.vals.fd_used and self.vals.fd_limit:
-fd_percent = 100 * self.vals.fd_used / self.vals.fd_limit
+  if self._vals.fd_used and self._vals.fd_limit:
+fd_percent = 100 * self._vals.fd_used / self._vals.fd_limit
 msg = Tor's file descriptor usage is at %i%%. % fd_percent
 
 if fd_percent = 90 and not self._is_fd_ninety_percent_warned:
@@ -413,28 +411,20 @@ class HeaderPanel(panel.Panel, threading.Thread):
 self._cond.release()
 
   def reset_listener(self, controller, event_type, _):
-
-Updates static parameters on tor reload (sighup) events.
-
+self._update()
 
-if event_type in (State.INIT, State.RESET):
-  initial_height = self.get_height()
+  def _update(self):
+previous_height = self.get_height()
+self._vals = Sampling(self._vals)
 
-  self.vals = Sampling(self.vals)
+if previous_height != self.get_height():
+  # We're toggling between being a relay and client, causing the height
+  # of this panel 

[tor-commits] [arm/master] Testing fixes for renamed functions and header panel

2014-09-01 Thread atagar
commit 514913522c74341bfad64e2d6da9939efb2e8b47
Author: Damian Johnson ata...@torproject.org
Date:   Mon Sep 1 20:57:01 2014 -0700

Testing fixes for renamed functions and header panel

Oops, didn't update our unit tests as I went along. Also a couple minor
corrections from static checks for our header panel.
---
 arm/header_panel.py |4 +---
 test/util/tracker/connection_tracker.py |4 ++--
 test/util/tracker/daemon.py |6 +++---
 test/util/tracker/resource_tracker.py   |6 +++---
 4 files changed, 9 insertions(+), 11 deletions(-)

diff --git a/arm/header_panel.py b/arm/header_panel.py
index 97a7fb3..0278285 100644
--- a/arm/header_panel.py
+++ b/arm/header_panel.py
@@ -19,7 +19,7 @@ import arm.popups
 import arm.starter
 import arm.util.tracker
 
-from stem.control import Listener, State
+from stem.control import Listener
 from stem.util import conf, log, str_tools
 
 from util import panel, tor_controller
@@ -358,8 +358,6 @@ class HeaderPanel(panel.Panel, threading.Thread):
 last_ran = -1
 
 while not self._halt:
-  current_time = time.time()
-
   if self.is_paused() or not self._vals.is_connected or (time.time() - 
last_ran)  UPDATE_RATE:
 with self._pause_condition:
   if not self._halt:
diff --git a/test/util/tracker/connection_tracker.py 
b/test/util/tracker/connection_tracker.py
index 0e756de..e6120bf 100644
--- a/test/util/tracker/connection_tracker.py
+++ b/test/util/tracker/connection_tracker.py
@@ -16,7 +16,7 @@ class TestConnectionTracker(unittest.TestCase):
   @patch('arm.util.tracker.tor_controller')
   @patch('arm.util.tracker.connection.get_connections')
   @patch('arm.util.tracker.system', Mock(return_value = Mock()))
-  @patch('arm.util.tracker.connection.get_system_resolvers', Mock(return_value 
= [connection.Resolver.NETSTAT]))
+  @patch('arm.util.tracker.connection.system_resolvers', Mock(return_value = 
[connection.Resolver.NETSTAT]))
   def test_fetching_connections(self, get_value_mock, tor_controller_mock):
 tor_controller_mock().get_pid.return_value = 12345
 get_value_mock.return_value = [CONNECTION_1, CONNECTION_2, CONNECTION_3]
@@ -39,7 +39,7 @@ class TestConnectionTracker(unittest.TestCase):
   @patch('arm.util.tracker.tor_controller')
   @patch('arm.util.tracker.connection.get_connections')
   @patch('arm.util.tracker.system', Mock(return_value = Mock()))
-  @patch('arm.util.tracker.connection.get_system_resolvers', Mock(return_value 
= [connection.Resolver.NETSTAT, connection.Resolver.LSOF]))
+  @patch('arm.util.tracker.connection.system_resolvers', Mock(return_value = 
[connection.Resolver.NETSTAT, connection.Resolver.LSOF]))
   def test_resolver_failover(self, get_value_mock, tor_controller_mock):
 tor_controller_mock().get_pid.return_value = 12345
 get_value_mock.side_effect = IOError()
diff --git a/test/util/tracker/daemon.py b/test/util/tracker/daemon.py
index 9d409e2..89f6031 100644
--- a/test/util/tracker/daemon.py
+++ b/test/util/tracker/daemon.py
@@ -14,7 +14,7 @@ class TestDaemon(unittest.TestCase):
 # properly retrieve the process' pid and name.
 
 tor_controller_mock().get_pid.return_value = 12345
-system_mock.get_name_by_pid.return_value = 'local_tor'
+system_mock.name_by_pid.return_value = 'local_tor'
 
 daemon = Daemon(0.05)
 
@@ -23,7 +23,7 @@ class TestDaemon(unittest.TestCase):
 self.assertEqual('local_tor', daemon._process_name)
 
 
tor_controller_mock().add_status_listener.assert_called_with(daemon._tor_status_listener)
-system_mock.get_name_by_pid.assert_called_with(12345)
+system_mock.name_by_pid.assert_called_with(12345)
 
   @patch('arm.util.tracker.tor_controller')
   @patch('arm.util.tracker.system')
@@ -31,7 +31,7 @@ class TestDaemon(unittest.TestCase):
 # Check when we default to 'tor' if unable to determine the process' name.
 
 tor_controller_mock().get_pid.return_value = 12345
-system_mock.get_name_by_pid.return_value = None
+system_mock.name_by_pid.return_value = None
 
 daemon = Daemon(0.05)
 self.assertEqual('tor', daemon._process_name)
diff --git a/test/util/tracker/resource_tracker.py 
b/test/util/tracker/resource_tracker.py
index 10509cf..64883d9 100644
--- a/test/util/tracker/resource_tracker.py
+++ b/test/util/tracker/resource_tracker.py
@@ -131,9 +131,9 @@ class TestResourceTracker(unittest.TestCase):
 self.assertEqual(0.004, memory_in_percent)
 
   @patch('time.time', Mock(return_value = 1388967218.973117))
-  @patch('arm.util.tracker.proc.get_stats', Mock(return_value = (1.5, 0.5, 
1388967200.9)))
-  @patch('arm.util.tracker.proc.get_memory_usage', Mock(return_value = 
(19300352, 6432)))
-  @patch('arm.util.tracker.proc.get_physical_memory', Mock(return_value = 
4825088000))
+  @patch('arm.util.tracker.proc.stats', Mock(return_value = (1.5, 0.5, 
1388967200.9)))
+  @patch('arm.util.tracker.proc.memory_usage', Mock(return_value = (19300352, 
6432)))
+  

[tor-commits] [arm/master] Replacing _halt_time with Controller's connection_time()

2014-09-01 Thread atagar
commit 24a2686530a4aef938a77493031be2e08160682c
Author: Damian Johnson ata...@torproject.org
Date:   Mon Sep 1 14:43:15 2014 -0700

Replacing _halt_time with Controller's connection_time()

Replacing our attribute that tracked when tor disconnected with the
Controller's new connection_time() method.
---
 arm/header_panel.py |   27 +--
 1 file changed, 9 insertions(+), 18 deletions(-)

diff --git a/arm/header_panel.py b/arm/header_panel.py
index 13194e4..cd037a1 100644
--- a/arm/header_panel.py
+++ b/arm/header_panel.py
@@ -46,11 +46,6 @@ class HeaderPanel(panel.Panel, threading.Thread):
 self._halt = False   # terminates thread if true
 self._cond = threading.Condition()  # used for pausing the thread
 
-# Time when the panel was paused or tor was stopped. This is used to
-# freeze the uptime statistic (uptime increments normally when None).
-
-self._halt_time = None
-
 # flag to indicate if we've already given file descriptor warnings
 
 self._is_fd_sixty_percent_warned = False
@@ -198,10 +193,8 @@ class HeaderPanel(panel.Panel, threading.Thread):
   space_left -= x - 43 - initial_x
 
   if space_left = 7 + len(vals.version_status):
-version_color = 
CONFIG['attr.version_status_colors'].get(vals.version_status, 'white')
-
 x = self.addstr(y, x, ' (')
-x = self.addstr(y, x, vals.version_status, version_color)
+x = self.addstr(y, x, vals.version_status, vals.version_color)
 self.addstr(y, x, ')')
 
   def _draw_ports_section(self, x, y, width, vals):
@@ -223,13 +216,11 @@ class HeaderPanel(panel.Panel, threading.Thread):
   self.addstr(y, x, vals.format(', Control Socket: {socket_path}'))
 else:
   if width = x + 19 + len(vals.control_port) + len(vals.auth_type):
-auth_color = 'red' if vals.auth_type == 'open' else 'green'
-
 x = self.addstr(y, x, ', Control Port (')
-x = self.addstr(y, x, vals.auth_type, auth_color)
+x = self.addstr(y, x, vals.auth_type, vals.auth_color)
 self.addstr(y, x, vals.format('): {control_port}'))
   else:
-self.addstr(y, x, ', Control Port: %s' % vals.control_port)
+self.addstr(y, x, vals.format(', Control Port: {control_port}'))
 
   def _draw_disconnected(self, x, y, width, vals):
 
@@ -239,7 +230,7 @@ class HeaderPanel(panel.Panel, threading.Thread):
 
 
 x = self.addstr(y, x, 'Tor Disconnected', curses.A_BOLD, 'red')
-self.addstr(y, x, ' (%s, press r to reconnect)' % vals.last_heartbeat)
+self.addstr(y, x, vals.format(' ({last_heartbeat}, press r to reconnect)'))
 
   def _draw_resource_usage(self, x, y, width, vals):
 
@@ -249,8 +240,8 @@ class HeaderPanel(panel.Panel, threading.Thread):
 
 
 if vals.start_time:
-  if not self.vals.is_connected:
-now = self._halt_time
+  if not vals.is_connected:
+now = vals.connection_time
   elif self.is_paused():
 now = self.get_pause_time()
   else:
@@ -428,7 +419,6 @@ class HeaderPanel(panel.Panel, threading.Thread):
 
 if event_type in (State.INIT, State.RESET):
   initial_height = self.get_height()
-  self._halt_time = None
 
   self.vals = Sampling(self.vals)
 
@@ -442,8 +432,6 @@ class HeaderPanel(panel.Panel, threading.Thread):
 # just need to redraw ourselves
 self.redraw(True)
 elif event_type == State.CLOSED:
-  self._halt_time = time.time()
-
   self.vals = Sampling(self.vals)
 
   self.redraw(True)
@@ -464,6 +452,7 @@ class Sampling(object):
 tor_resources = arm.util.tracker.get_resource_tracker().get_value()
 
 self.is_connected = controller.is_alive()
+self.connection_time = controller.connection_time()
 self.last_heartbeat = time.strftime('%H:%M %m/%d/%Y', 
time.localtime(controller.get_latest_heartbeat()))
 self.retrieved = time.time()
 self.arm_total_cpu_time = sum(os.times()[:3])
@@ -484,10 +473,12 @@ class Sampling(object):
 else:
   self.auth_type = 'open'
 
+self.auth_color = 'red' if self.auth_type == 'open' else 'green'
 self.exit_policy = controller.get_exit_policy(None)
 self.flags = self._get_flags(controller)
 self.version = str(controller.get_version('Unknown')).split()[0]
 self.version_status = controller.get_info('status/version/current', 
'Unknown')
+self.version_color = 
CONFIG['attr.version_status_colors'].get(self.version_status, 'white')
 
 self.pid = controller.get_pid('')
 self.start_time = stem.util.system.get_start_time(controller.get_pid(None))



___
tor-commits mailing list
tor-commits@lists.torproject.org
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits


[tor-commits] [arm/master] Dropping _get_flags() helper

2014-09-01 Thread atagar
commit 24c56a01ea634291d91c7b970929fff2b4974893
Author: Damian Johnson ata...@torproject.org
Date:   Mon Sep 1 16:59:26 2014 -0700

Dropping _get_flags() helper

We can do this in one line via getattr(), so no need for a helper.
---
 arm/header_panel.py |   21 +++--
 1 file changed, 3 insertions(+), 18 deletions(-)

diff --git a/arm/header_panel.py b/arm/header_panel.py
index 2371667..beccb0c 100644
--- a/arm/header_panel.py
+++ b/arm/header_panel.py
@@ -435,6 +435,7 @@ class Sampling(object):
   def __init__(self, last_sampling = None):
 controller = tor_controller()
 
+fingerprint = controller.get_info('fingerprint', None)
 or_listeners = controller.get_listeners(Listener.OR, [])
 fd_limit = controller.get_info('process/descriptor-limit', '-1')
 
@@ -447,7 +448,7 @@ class Sampling(object):
 self.retrieved = time.time()
 self.arm_total_cpu_time = sum(os.times()[:3])
 
-self.fingerprint = controller.get_info('fingerprint', 'Unknown')
+self.fingerprint = fingerprint if fingerprint else 'Unknown'
 self.nickname = controller.get_conf('Nickname', '')
 self.or_address = or_listeners[0][0] if or_listeners else 
controller.get_info('address', 'Unknown')
 self.or_port = or_listeners[0][1] if or_listeners else ''
@@ -466,7 +467,7 @@ class Sampling(object):
 
 self.auth_color = 'red' if self.auth_type == 'open' else 'green'
 self.exit_policy = controller.get_exit_policy(None)
-self.flags = self._get_flags(controller)
+self.flags = getattr(controller.get_network_status(fingerprint, None), 
'flags', [])
 self.version = str(controller.get_version('Unknown')).split()[0]
 self.version_status = controller.get_info('status/version/current', 
'Unknown')
 self.version_color = 
CONFIG['attr.version_status_colors'].get(self.version_status, 'white')
@@ -499,22 +500,6 @@ class Sampling(object):
 
 return formatted_msg
 
-  def _get_flags(self, controller):
-
-Provides the flags held by our relay. This is an empty list if it can't be
-determined, likely because we don't have our own router status entry yet.
-
-:param stem.control.Controller controller: tor control connection
-
-:returns: **list** with the relays held by our relay
-
-
-try:
-  my_fingerprint = controller.get_info('fingerprint')
-  return controller.get_network_status(my_fingerprint).flags
-except stem.ControllerError:
-  return []
-
   def _get_cpu_percentage(self, last_sampling):
 
 Determine the cpu usage of our own process since the last sampling.



___
tor-commits mailing list
tor-commits@lists.torproject.org
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits


[tor-commits] [arm/master] Use log_once() rather than tracking separately

2014-09-01 Thread atagar
commit a827941efb16b120dcc86add53bac7b66d9f2c27
Author: Damian Johnson ata...@torproject.org
Date:   Mon Sep 1 17:24:20 2014 -0700

Use log_once() rather than tracking separately

Stem's log module has a log_once() method to avoid logging about the same 
thing
multiple times. Using that rather than tracking it via a header panel
attribute.
---
 arm/header_panel.py |   40 +++-
 1 file changed, 15 insertions(+), 25 deletions(-)

diff --git a/arm/header_panel.py b/arm/header_panel.py
index 4ce13b5..6e1f381 100644
--- a/arm/header_panel.py
+++ b/arm/header_panel.py
@@ -26,6 +26,7 @@ from util import panel, tor_controller
 
 MIN_DUAL_COL_WIDTH = 141  # minimum width where we'll show two columns
 SHOW_FD_THRESHOLD = 60  # show file descriptor usage if usage is over this 
percentage
+UPDATE_RATE = 5  # rate in seconds at which we refresh
 
 CONFIG = conf.config_dict('arm', {
   'attr.flag_colors': {},
@@ -43,17 +44,10 @@ class HeaderPanel(panel.Panel, threading.Thread):
 threading.Thread.__init__(self)
 self.setDaemon(True)
 
-self._pause_condition = threading.Condition()
-self._halt = False  # terminates thread if true
-
-# flag to indicate if we've already given file descriptor warnings
-
-self._is_fd_sixty_percent_warned = False
-self._is_fd_ninety_percent_warned = False
-
 self._vals = Sampling()
 
-# listens for tor reload (sighup) events
+self._pause_condition = threading.Condition()
+self._halt = False  # terminates thread if true
 
 tor_controller().add_status_listener(self.reset_listener)
 
@@ -360,28 +354,14 @@ class HeaderPanel(panel.Panel, threading.Thread):
 while not self._halt:
   current_time = time.time()
 
-  if self.is_paused() or not self._vals.is_connected or (time.time() - 
last_ran)  1:
+  if self.is_paused() or not self._vals.is_connected or (time.time() - 
last_ran)  UPDATE_RATE:
 with self._pause_condition:
   if not self._halt:
 self._pause_condition.wait(0.2)
 
 continue  # done waiting, try again
 
-  self._vals = Sampling(self._vals)
-
-  if self._vals.fd_used and self._vals.fd_limit:
-fd_percent = 100 * self._vals.fd_used / self._vals.fd_limit
-msg = Tor's file descriptor usage is at %i%%. % fd_percent
-
-if fd_percent = 90 and not self._is_fd_ninety_percent_warned:
-  self._is_fd_sixty_percent_warned, self._is_fd_ninety_percent_warned 
= True, True
-  msg += ' If you run out Tor will be unable to continue functioning.'
-  log.warn(msg)
-elif fd_percent = 60 and not self._is_fd_sixty_percent_warned:
-  self._is_fd_sixty_percent_warned = True
-  log.notice(msg)
-
-  self.redraw(True)
+  self._update()
   last_ran = time.time()
 
   def stop(self):
@@ -472,6 +452,16 @@ class Sampling(object):
 self.hostname = uname_vals[1]
 self.platform = '%s %s' % (uname_vals[0], uname_vals[2])  # [platform 
name] [version]
 
+if self.fd_used and self.fd_limit:
+  fd_percent = 100 * self.fd_used / self.fd_limit
+  msg = Tor's file descriptor usage is at %i%%. % fd_percent
+
+  if fd_percent = 90:
+msg += ' If you run out Tor will be unable to continue functioning.'
+log.log_once('fd_used_at_ninety_percent', log.WARN, msg)
+  elif fd_percent = 60:
+log.log_once('fd_used_at_sixty_percent', log.NOTICE, msg)
+
   def format(self, msg, crop_width = None):
 
 Applies our attributes to the given string.



___
tor-commits mailing list
tor-commits@lists.torproject.org
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits


[tor-commits] [arm/master] Using stem's new util function names

2014-09-01 Thread atagar
commit 98e8d6993909089fd57bdcab01f9851b7cafa3f1
Author: Damian Johnson ata...@torproject.org
Date:   Mon Sep 1 20:41:47 2014 -0700

Using stem's new util function names

Accounting for the newely renamed stem util functions.
---
 arm/config_panel.py |4 ++--
 arm/connections/conn_entry.py   |2 +-
 arm/controller.py   |2 +-
 arm/graphing/bandwidth_stats.py |   26 +-
 arm/graphing/graph_panel.py |2 +-
 arm/graphing/resource_stats.py  |4 ++--
 arm/header_panel.py |6 +++---
 arm/starter.py  |2 +-
 arm/util/tor_config.py  |6 +++---
 arm/util/tracker.py |4 ++--
 run_tests.py|4 ++--
 11 files changed, 31 insertions(+), 31 deletions(-)

diff --git a/arm/config_panel.py b/arm/config_panel.py
index e71948b..c2dac4b 100644
--- a/arm/config_panel.py
+++ b/arm/config_panel.py
@@ -205,9 +205,9 @@ class ConfigEntry():
 elif self.get(Field.TYPE) == Boolean and conf_value in (0, 1):
   conf_value = False if conf_value == 0 else True
 elif self.get(Field.TYPE) == DataSize and conf_value.isdigit():
-  conf_value = str_tools.get_size_label(int(conf_value))
+  conf_value = str_tools.size_label(int(conf_value))
 elif self.get(Field.TYPE) == TimeInterval and conf_value.isdigit():
-  conf_value = str_tools.get_time_label(int(conf_value), is_long = True)
+  conf_value = str_tools.time_label(int(conf_value), is_long = True)
 
 return conf_value
 
diff --git a/arm/connections/conn_entry.py b/arm/connections/conn_entry.py
index 4b9a017..f3ea97a 100644
--- a/arm/connections/conn_entry.py
+++ b/arm/connections/conn_entry.py
@@ -351,7 +351,7 @@ class ConnectionLine(entries.ConnectionPanelLine):
 else:
   time_prefix = 
 
-time_label = time_prefix + %5s % str_tools.get_time_label(current_time - 
self.start_time, 1)
+time_label = time_prefix + %5s % str_tools.time_label(current_time - 
self.start_time, 1)
 my_listing[2] = (time_label, my_listing[2][1])
 
 return my_listing
diff --git a/arm/controller.py b/arm/controller.py
index f18af9c..4a864b9 100644
--- a/arm/controller.py
+++ b/arm/controller.py
@@ -145,7 +145,7 @@ def init_controller(stdscr, start_time):
 
   if tor_pid:
 # use the tor pid to help narrow connection results
-tor_cmd = system.get_name_by_pid(tor_pid)
+tor_cmd = system.name_by_pid(tor_pid)
 
 if tor_cmd is None:
   tor_cmd = tor
diff --git a/arm/graphing/bandwidth_stats.py b/arm/graphing/bandwidth_stats.py
index 16cc349..dedde65 100644
--- a/arm/graphing/bandwidth_stats.py
+++ b/arm/graphing/bandwidth_stats.py
@@ -276,7 +276,7 @@ class BandwidthStats(graph_panel.GraphStats):
 missing_sec = time.time() - min(last_read_time, last_write_time)
 
 if missing_sec:
-  msg +=  (%s is missing) % str_tools.get_time_label(missing_sec, 0, 
True)
+  msg +=  (%s is missing) % str_tools.time_label(missing_sec, 0, True)
 
 log.notice(msg)
 
@@ -376,7 +376,7 @@ class BandwidthStats(graph_panel.GraphStats):
   stats[1] = - %s % self._get_avg_label(is_primary)
   stats[2] = , %s % self._get_total_label(is_primary)
 
-stats[0] = %-14s % (%s/sec % 
str_tools.get_size_label((self.last_primary if is_primary else 
self.last_secondary) * 1024, 1, False, 
CONFIG[features.graph.bw.transferInBytes]))
+stats[0] = %-14s % (%s/sec % str_tools.size_label((self.last_primary 
if is_primary else self.last_secondary) * 1024, 1, False, 
CONFIG[features.graph.bw.transferInBytes]))
 
 # drops label's components if there's not enough space
 
@@ -418,8 +418,8 @@ class BandwidthStats(graph_panel.GraphStats):
   label_in_bytes = CONFIG[features.graph.bw.transferInBytes]
 
   if bw_rate and bw_burst:
-bw_rate_label = str_tools.get_size_label(bw_rate, 1, False, 
label_in_bytes)
-bw_burst_label = str_tools.get_size_label(bw_burst, 1, False, 
label_in_bytes)
+bw_rate_label = str_tools.size_label(bw_rate, 1, False, label_in_bytes)
+bw_burst_label = str_tools.size_label(bw_burst, 1, False, 
label_in_bytes)
 
 # if both are using rounded values then strip off the .0 decimal
 
@@ -435,9 +435,9 @@ class BandwidthStats(graph_panel.GraphStats):
   # if there isn't yet enough bandwidth measurements).
 
   if bw_observed and (not bw_measured or bw_measured == bw_observed):
-stats.append(observed: %s/s % str_tools.get_size_label(bw_observed, 
1, False, label_in_bytes))
+stats.append(observed: %s/s % str_tools.size_label(bw_observed, 1, 
False, label_in_bytes))
   elif bw_measured:
-stats.append(measured: %s/s % str_tools.get_size_label(bw_measured, 
1, False, label_in_bytes))
+stats.append(measured: %s/s % str_tools.size_label(bw_measured, 1, 
False, label_in_bytes))
 
   self._title_stats = stats
 
@@ -445,12 +445,12 @@ class BandwidthStats(graph_panel.GraphStats):
 

[tor-commits] [stem/master] connection_time() method for the BaseController

2014-09-01 Thread atagar
commit d220b901851db31758e4f38703b31e090cbb471b
Author: Damian Johnson ata...@torproject.org
Date:   Mon Sep 1 14:34:11 2014 -0700

connection_time() method for the BaseController

Adding a connection_time() to our ControlSocket and BaseController to 
provide
when we either connected or disconnected from the socket.
---
 docs/change_log.rst |4 
 run_tests.py|2 ++
 stem/control.py |   12 
 stem/socket.py  |   16 +++
 test/integ/socket/control_socket.py |   37 +++
 5 files changed, 71 insertions(+)

diff --git a/docs/change_log.rst b/docs/change_log.rst
index 0e605ca..2b6964c 100644
--- a/docs/change_log.rst
+++ b/docs/change_log.rst
@@ -40,6 +40,10 @@ Unreleased
 The following are only available within Stem's `git repository
 download.html`_.
 
+ * **Controller**
+
+  * Added :func:`~stem.control.BaseController.connection_time` to the 
:class:`~stem.control.BaseController`
+
  * **Descriptors**
 
   * Improved speed for parsing consensus documents by around 30% 
(:trac:`12859`)
diff --git a/run_tests.py b/run_tests.py
index 3c91513..2d73457 100755
--- a/run_tests.py
+++ b/run_tests.py
@@ -279,7 +279,9 @@ def main():
   except OSError:
 error_tracker.register_error()
   finally:
+println()
 integ_runner.stop()
+println()
 
 if skipped_targets:
   println()
diff --git a/stem/control.py b/stem/control.py
index e2f133d..8571a7f 100644
--- a/stem/control.py
+++ b/stem/control.py
@@ -478,6 +478,18 @@ class BaseController(object):
 
 return self._socket.is_alive()
 
+  def connection_time(self):
+
+Provides the unix timestamp for when our socket was either connected or
+disconnected. That is to say, the time we connected if we're presently
+connected and the time we disconnected if we're not connected.
+
+:returns: **float** for when we last connected or disconnected, zero if
+  we've never connected
+
+
+return self._socket.connection_time()
+
   def is_authenticated(self):
 
 Checks if our socket is both connected and authenticated.
diff --git a/stem/socket.py b/stem/socket.py
index 1d664c0..e25f385 100644
--- a/stem/socket.py
+++ b/stem/socket.py
@@ -72,6 +72,7 @@ from __future__ import absolute_import
 import re
 import socket
 import threading
+import time
 
 import stem.prereq
 import stem.response
@@ -93,6 +94,7 @@ class ControlSocket(object):
   def __init__(self):
 self._socket, self._socket_file = None, None
 self._is_alive = False
+self._connection_time = 0.0  # time when we last connected or disconnected
 
 # Tracks sending and receiving separately. This should be safe, and doing
 # so prevents deadlock where we block writes because we're waiting to read
@@ -203,6 +205,18 @@ class ControlSocket(object):
 
 return False
 
+  def connection_time(self):
+
+Provides the unix timestamp for when our socket was either connected or
+disconnected. That is to say, the time we connected if we're presently
+connected and the time we disconnected if we're not connected.
+
+:returns: **float** for when we last connected or disconnected, zero if
+  we've never connected
+
+
+return self._connection_time
+
   def connect(self):
 
 Connects to a new socket, closing our previous one if we're already
@@ -223,6 +237,7 @@ class ControlSocket(object):
 self._socket = self._make_socket()
 self._socket_file = self._socket.makefile(mode = 'rwb')
 self._is_alive = True
+self._connection_time = time.time()
 
 # It's possible for this to have a transient failure...
 # SocketError: [Errno 4] Interrupted system call
@@ -273,6 +288,7 @@ class ControlSocket(object):
   self._socket = None
   self._socket_file = None
   self._is_alive = False
+  self._connection_time = time.time()
 
   if is_change:
 self._close()
diff --git a/test/integ/socket/control_socket.py 
b/test/integ/socket/control_socket.py
index 7d7b84f..f0f2e40 100644
--- a/test/integ/socket/control_socket.py
+++ b/test/integ/socket/control_socket.py
@@ -8,6 +8,7 @@ those focus on parsing and correctness of the content these are 
more concerned
 with the behavior of the socket itself.
 
 
+import time
 import unittest
 
 import stem.connection
@@ -17,6 +18,42 @@ import test.runner
 
 
 class TestControlSocket(unittest.TestCase):
+  def test_connection_time(self):
+
+Checks that our connection_time method tracks when our state's changed.
+
+
+if test.runner.require_control(self):
+  return
+
+test_start = time.time()
+runner = test.runner.get_runner()
+
+with runner.get_tor_socket() as control_socket:
+  connection_time = control_socket.connection_time()
+
+  # connection time should be between our tests start and now
+
+  

[tor-commits] [arm/master] Drop old cruft for limiting header panel refreshes

2014-09-01 Thread atagar
commit 9777ed646e740de2ad84ca78b15c88b0215b48cb
Author: Damian Johnson ata...@torproject.org
Date:   Mon Sep 1 17:05:01 2014 -0700

Drop old cruft for limiting header panel refreshes

We once tried to be smart about refreshing the header panel's contents,
breaking it into two phases...

  * cheap to query data that refreshes frequently
  * costly data we refresh periodically

This was to avoid excessive GETINFO/GETCONF queries and system calls. 
However,
Stem caches most controller data and our tracker module rate limits system
calls so the header panel doesn't need to worry about this as much. Dropping
the legacy cruft.
---
 arm/header_panel.py |   78 ---
 1 file changed, 31 insertions(+), 47 deletions(-)

diff --git a/arm/header_panel.py b/arm/header_panel.py
index beccb0c..4ce13b5 100644
--- a/arm/header_panel.py
+++ b/arm/header_panel.py
@@ -43,8 +43,8 @@ class HeaderPanel(panel.Panel, threading.Thread):
 threading.Thread.__init__(self)
 self.setDaemon(True)
 
-self._halt = False   # terminates thread if true
-self._cond = threading.Condition()  # used for pausing the thread
+self._pause_condition = threading.Condition()
+self._halt = False  # terminates thread if true
 
 # flag to indicate if we've already given file descriptor warnings
 
@@ -355,60 +355,43 @@ class HeaderPanel(panel.Panel, threading.Thread):
 Keeps stats updated, checking for new information at a set rate.
 
 
-last_draw = time.time() - 1
+last_ran = -1
 
 while not self._halt:
   current_time = time.time()
 
-  if self.is_paused() or current_time - last_draw  1 or not 
self._vals.is_connected:
-self._cond.acquire()
+  if self.is_paused() or not self._vals.is_connected or (time.time() - 
last_ran)  1:
+with self._pause_condition:
+  if not self._halt:
+self._pause_condition.wait(0.2)
 
-if not self._halt:
-  self._cond.wait(0.2)
+continue  # done waiting, try again
 
-self._cond.release()
-  else:
-# Update the volatile attributes (cpu, memory, flags, etc) if we have
-# a new resource usage sampling (the most dynamic stat) or its been
-# twenty seconds since last fetched (so we still refresh occasionally
-# when resource fetches fail).
-#
-# Otherwise, just redraw the panel to change the uptime field.
-
-is_changed = False
-
-if self._vals.pid:
-  # resource_tracker = arm.util.tracker.get_resource_tracker()
-  # is_changed = self._last_resource_fetch != 
resource_tracker.run_counter()
-  is_changed = True  # TODO: we should decide to redraw or not based 
on if the sampling values have changed
-
-if is_changed or (self._vals and current_time - self._vals.retrieved 
= 20):
-  self._vals = Sampling(self._vals)
-
-  if self._vals.fd_used and self._vals.fd_limit:
-fd_percent = 100 * self._vals.fd_used / self._vals.fd_limit
-msg = Tor's file descriptor usage is at %i%%. % fd_percent
-
-if fd_percent = 90 and not self._is_fd_ninety_percent_warned:
-  self._is_fd_sixty_percent_warned, 
self._is_fd_ninety_percent_warned = True, True
-  msg += ' If you run out Tor will be unable to continue 
functioning.'
-  log.warn(msg)
-elif fd_percent = 60 and not self._is_fd_sixty_percent_warned:
-  self._is_fd_sixty_percent_warned = True
-  log.notice(msg)
-
-self.redraw(True)
-last_draw += 1
+  self._vals = Sampling(self._vals)
+
+  if self._vals.fd_used and self._vals.fd_limit:
+fd_percent = 100 * self._vals.fd_used / self._vals.fd_limit
+msg = Tor's file descriptor usage is at %i%%. % fd_percent
+
+if fd_percent = 90 and not self._is_fd_ninety_percent_warned:
+  self._is_fd_sixty_percent_warned, self._is_fd_ninety_percent_warned 
= True, True
+  msg += ' If you run out Tor will be unable to continue functioning.'
+  log.warn(msg)
+elif fd_percent = 60 and not self._is_fd_sixty_percent_warned:
+  self._is_fd_sixty_percent_warned = True
+  log.notice(msg)
+
+  self.redraw(True)
+  last_ran = time.time()
 
   def stop(self):
 
 Halts further resolutions and terminates the thread.
 
 
-self._cond.acquire()
-self._halt = True
-self._cond.notifyAll()
-self._cond.release()
+with self._pause_condition:
+  self._halt = True
+  self._pause_condition.notifyAll()
 
   def reset_listener(self, controller, event_type, _):
 self._update()
@@ -435,6 +418,7 @@ class Sampling(object):
   def __init__(self, last_sampling = None):
 controller = tor_controller()
 
+pid = controller.get_pid(None)
 fingerprint = controller.get_info('fingerprint', None)