[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [chutney/master] remove stale lock file for crashed Tor
commit 93c06edf52eacb90f5950815dcb234ee13324703
Author: Qingping Hou <dave2008713@xxxxxxxxx>
Date: Mon Feb 17 23:01:07 2014 -0500
remove stale lock file for crashed Tor
---
lib/chutney/TorNet.py | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/lib/chutney/TorNet.py b/lib/chutney/TorNet.py
index 77e768a..74ec087 100644
--- a/lib/chutney/TorNet.py
+++ b/lib/chutney/TorNet.py
@@ -466,6 +466,14 @@ class LocalNodeController(NodeController):
return
os.kill(pid, sig)
+ def cleanup_lockfile(self):
+ lf = self._env['lockfile']
+ if self.isRunning() or (not os.path.exists(lf)):
+ return
+ print 'Removing stale lock file for {0} ...'.format(
+ self._env['nick'])
+ os.remove(lf)
+
@@ -547,6 +555,9 @@ class TorEnviron(chutney.Templating.Environ):
def _get_torrc_template_path(self, my):
return [ os.path.join(my['chutney_dir'], 'torrc_templates') ]
+ def _get_lockfile(self, my):
+ return os.path.join(self['dir'], 'lock')
+
class Network(object):
"""A network of Tor nodes, plus functions to manipulate them
@@ -624,6 +635,9 @@ class Network(object):
for n in xrange(15):
time.sleep(1)
if all(not c.isRunning() for c in controllers):
+ # check for stale lock file when Tor crashes
+ for c in controllers:
+ c.cleanup_lockfile()
return
sys.stdout.write(".")
sys.stdout.flush()
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits