Some docstrings.
diff --git a/discovery.py b/discovery.py
index d20386e..6206af3 100644
--- a/discovery.py
+++ b/discovery.py
@@ -22,11 +22,6 @@ servicenames = {'_ssh._tcp': 'ssh',
'_pulse-server._tcp': 'pulseaudio',
'_nameserver._udp': 'dns'}
-def on_sigint(signum, frame):
- print "Got SIGINT"
- sys.exit()
-
-
class Browser(threading.Thread):
def __init__(self,group=None,target=None,name=None,args=(), kwargs=None,verbose=None):
threading.Thread.__init__(self)
@@ -112,6 +107,8 @@ class ZeroconfListener(object):
# print "services[%s] = %s" % (sname, svc)
def discover(services=('_ssh._tcp','_workstation._tcp','_nameserver._udp'),timeout=None):
+ """Discover services of given types via zeroconf.
+ Returns (blocked) lock, which is released when all services are discovered."""
global browser
lock = threading.Lock()
lock.acquire()
@@ -124,5 +121,6 @@ def discover(services=('_ssh._tcp','_workstation._tcp','_nameserver._udp'),timeo
return lock
def stop():
+ "Cancel discovery"
global browser
browser.quit()
diff --git a/test.py b/test.py
index d409b92..cdd8a40 100755
--- a/test.py
+++ b/test.py
@@ -57,6 +57,7 @@ machine.hostname = 'portnov'
templates.services = discovery.services
templates.machine = machine
+
print "Waiting for discovery..."
lock.acquire()