summaryrefslogtreecommitdiffstats
path: root/avahi-utils
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2005-08-03 21:07:02 +0000
committerLennart Poettering <lennart@poettering.net>2005-08-03 21:07:02 +0000
commit3a625af272ee8c6f878ba4d44ed1c741a1582395 (patch)
treeee5fb1f6bff53c670cede2882bbe69d408777894 /avahi-utils
parent69ea921fa92b0b23faf0a955628e3afab5117534 (diff)
* add C examples
* change doxygen to output stuff in "doxygen/" instead of "doxygen-doc/" * implement avahi_entry_group_{reset,is_empty}() and make everyone use it * move holdoff (SLEEPING) time checking from server to entry group * add preliminary error codes git-svn-id: file:///home/lennart/svn/public/avahi/trunk@216 941a03a8-eaeb-0310-b9a0-b1bbd8fe43fe
Diffstat (limited to 'avahi-utils')
-rwxr-xr-xavahi-utils/avahi-publish-service.in15
-rw-r--r--avahi-utils/avahi/__init__.py5
2 files changed, 11 insertions, 9 deletions
diff --git a/avahi-utils/avahi-publish-service.in b/avahi-utils/avahi-publish-service.in
index dfb21ab..ee0be76 100755
--- a/avahi-utils/avahi-publish-service.in
+++ b/avahi-utils/avahi-publish-service.in
@@ -70,16 +70,18 @@ n_rename = 0
def remove_service():
global group
- if not (group is None):
- group.Free()
- group = None
+ if not group is None:
+ group.Reset()
def add_service():
global server, group, name, stype, domain, host, port, txt
- assert group is None
+
+ if group is None:
+ group = dbus.Interface(bus.get_object(avahi.DBUS_NAME, server.EntryGroupNew()), avahi.DBUS_INTERFACE_ENTRY_GROUP)
+
+ assert group.IsEmpty()
print "Adding service '%s' of type '%s' ..." % (name, stype)
- group = dbus.Interface(bus.get_object(avahi.DBUS_NAME, server.EntryGroupNew()), avahi.DBUS_INTERFACE_ENTRY_GROUP)
group.connect_to_signal('StateChanged', entry_group_state_changed)
group.AddService(avahi.IF_UNSPEC, avahi.PROTO_UNSPEC, name, stype, domain, host, dbus.UInt16(port), txt)
group.Commit()
@@ -120,4 +122,5 @@ try:
except KeyboardInterrupt, k:
pass
-remove_service()
+if not group is None:
+ group.Free()
diff --git a/avahi-utils/avahi/__init__.py b/avahi-utils/avahi/__init__.py
index 539dabb..831c173 100644
--- a/avahi-utils/avahi/__init__.py
+++ b/avahi-utils/avahi/__init__.py
@@ -1,4 +1,3 @@
-#!/usr/bin/python2.4
# $Id$
# This file is part of avahi.
@@ -21,9 +20,9 @@
# Some definitions matching those in core.h
import socket
-SERVER_INVALID, SERVER_REGISTERING, SERVER_RUNNING, SERVER_COLLISION, SERVER_SLEEPING = range(-1, 4)
+SERVER_INVALID, SERVER_REGISTERING, SERVER_RUNNING, SERVER_COLLISION = range(-1, 3)
-ENTRY_GROUP_UNCOMMITED, ENTRY_GROUP_REGISTERING, ENTRY_GROUP_ESTABLISHED, ENTRY_GROUP_COLLISION = range(-1, 3)
+ENTRY_GROUP_UNCOMMITED, ENTRY_GROUP_REGISTERING, ENTRY_GROUP_ESTABLISHED, ENTRY_GROUP_COLLISION, ENTRY_GROUP_SLEEPING = range(-1, 4)
DOMAIN_BROWSER_REGISTER, DOMAIN_BROWSER_REGISTER_DEFAULT, DOMAIN_BROWSER_BROWSE, DOMAIN_BROWSER_BROWSE_DEFAULT, DOMAIN_BROWSER_BROWSE_LEGACY = range(0, 5)