From c1d3dcd4f311f0fa621d9c83210f999741755b7a Mon Sep 17 00:00:00 2001 From: Matthew Johnson Date: Tue, 18 Nov 2008 03:20:08 +0000 Subject: PeerSet works --- Makefile | 1 + changelog | 7 +++++++ debug.conf | 5 +++-- org/freedesktop/dbus/DBusConnection.java | 14 +++++++------- org/freedesktop/dbus/bin/DBusDaemon.java | 2 +- org/freedesktop/dbus/test/test.java | 2 +- 6 files changed, 20 insertions(+), 11 deletions(-) diff --git a/Makefile b/Makefile index e28d5b2..4b39270 100644 --- a/Makefile +++ b/Makefile @@ -193,6 +193,7 @@ check: libdbus-java-$(VERSION).jar dbus-java-test-$(VERSION).jar testbin/DBusDae testbin/DBusDaemon --addressfile address --pidfile pid 2> server.log&\ sleep 1; \ export DBUS_SESSION_BUS_ADDRESS=$$(cat address) ;\ + dbus-monitor >> monitor.log &\ if $(MAKE) DBUS_JAVA_FLOATS=true DEBUG=$(DEBUG) testrun 2>&1 | tee client.log; then export PASS=true; fi ; \ kill $$(cat pid) ; \ if [ "$$PASS" = "true" ]; then exit 0; else exit 1; fi ) diff --git a/changelog b/changelog index bc5a0e7..7b9554e 100644 --- a/changelog +++ b/changelog @@ -1,3 +1,10 @@ +Version 2.6: + + * Add DBusConnection.releaseBusName API + * Add DBusConnection.PeerSet for tracking peer lifetimes + * Fix bug where DBusDaemon never sends NameOwnerChanged/NameLost + signals + Version 2.5.1: * Fix for possible NPex in DBusDaemon diff --git a/debug.conf b/debug.conf index 5da0a4a..ef244b6 100644 --- a/debug.conf +++ b/debug.conf @@ -1,14 +1,15 @@ org.freedesktop.dbus.MessageReader = ERR org.freedesktop.dbus.MessageWriter = ERR -org.freedesktop.dbus.Message = DEBUG +org.freedesktop.dbus.Message = ERR org.freedesktop.dbus.MethodCall = ERR org.freedesktop.dbus.MethodTuple = ERR -org.freedesktop.dbus.AbstractConnection = INFO +org.freedesktop.dbus.AbstractConnection = ERR org.freedesktop.dbus.AbstractConnection$FallbackContainer = ERR org.freedesktop.dbus.AbstractConnection$_thread = ERR org.freedesktop.dbus.AbstractConnection$_sender = ERR org.freedesktop.dbus.DirectConnection = ERR org.freedesktop.dbus.DBusConnection = ERR +org.freedesktop.dbus.DBusConnection$PeerSet = DEBUG org.freedesktop.dbus.AbstractConnection$1 = ERR org.freedesktop.dbus.DBusSignal = ERR org.freedesktop.dbus.EfficientQueue = ERR diff --git a/org/freedesktop/dbus/DBusConnection.java b/org/freedesktop/dbus/DBusConnection.java index 058a033..43a5b04 100644 --- a/org/freedesktop/dbus/DBusConnection.java +++ b/org/freedesktop/dbus/DBusConnection.java @@ -63,13 +63,15 @@ public class DBusConnection extends AbstractConnection } public void handle(DBus.NameOwnerChanged noc) { + if (Debug.debug) + Debug.print(Debug.DEBUG, "Received NameOwnerChanged("+noc.name+","+noc.old_owner+","+noc.new_owner+")"); if ("".equals(noc.new_owner) && addresses.contains(noc.name)) - synchronized (addresses) { - addresses.remove(noc.name); - } + remove(noc.name); } public boolean add(String address) { + if (Debug.debug) + Debug.print(Debug.DEBUG, "Adding "+address); synchronized (addresses) { return addresses.add(address); } @@ -114,6 +116,8 @@ public class DBusConnection extends AbstractConnection } public boolean remove(Object o) { + if (Debug.debug) + Debug.print(Debug.DEBUG, "Removing "+o); synchronized(addresses) { return addresses.remove(o); } @@ -735,8 +739,4 @@ public class DBusConnection extends AbstractConnection } } } - public PeerSet getPeerSet() - { - return new PeerSet(); - } } diff --git a/org/freedesktop/dbus/bin/DBusDaemon.java b/org/freedesktop/dbus/bin/DBusDaemon.java index bedaff3..fb75241 100644 --- a/org/freedesktop/dbus/bin/DBusDaemon.java +++ b/org/freedesktop/dbus/bin/DBusDaemon.java @@ -240,7 +240,7 @@ public class DBusDaemon extends Thread } int rv; - if (exists) { + if (!exists) { rv = DBus.DBUS_RELEASE_NAME_REPLY_NON_EXISTANT; } else { if (Debug.debug) Debug.print(Debug.WARN, "Client "+c.unique+" acquired name "+name); diff --git a/org/freedesktop/dbus/test/test.java b/org/freedesktop/dbus/test/test.java index a4b1ae4..5333723 100644 --- a/org/freedesktop/dbus/test/test.java +++ b/org/freedesktop/dbus/test/test.java @@ -774,7 +774,7 @@ public class test serverconn.sendSignal(new TestSignalInterface.TestObjectSignal("/foo/bar/Wibble", tclass)); // setup bus name set - Set peers = serverconn.getPeerSet(); + Set peers = serverconn.new PeerSet(); peers.add("org.freedesktop.DBus"); clientconn.requestBusName("test.testclient"); peers.add("test.testclient"); -- cgit v1.2.3