Connection closed err in code. Dbus-send works fine though

PookieMonster pookie at mailinator.com
Tue Jul 26 10:12:03 PDT 2011



[Bluetooth] set up DBUS handler
[Bluetooth] /org/bluez/agent_317
[Bluetooth] Got connection on system bus.  Get adapter path
[Bluetooth] Can't get default adapter
[Bluetooth] Name: org.freedesktop.DBus.Error.Disconnected Msg: Connection is
closed


On Tue, 26 Jul 2011 at 09:02:48 -0700, PookieMonster wrote:
> reply is coming back NULL and err is set so I get this output:
> 
> [Bluetooth] Can't get default adapter
> [Bluetooth] Connection is closed

Your DBusConnection has probably already closed (to confirm, you usually
want
to print err.name as well as err.message in debug output, to tell you which
machine-readable error code was produced).
</quote]
Just to add the err.name to the err.message already posted:

[Bluetooth] Can't get default adapter
[Bluetooth] Name: org.freedesktop.DBus.Error.Disconnected Msg: Connection is
closed


Simon McVittie-6 wrote:
> 
> Don't send method calls to a connection that has already been
> disconnected,
> and you'll have more success :-)
> 
Fair advice, but why would my connection be closing?  The code flow reads:

conn = dbus_bus_get(DBUS_BUS_SYSTEM, NULL);
msg = dbus_message_new_method_call("org.bluez", "/","org.bluez.Manager",
"DefaultAdapter");
dbus_error_init(&err);
reply = dbus_connection_send_with_reply_and_block(conn, msg, -1, &err);

(if statements checking to make sure returns were valid have been removed to
consolidate code.)

Since this is the code that BlueZ provides and everyone else seems to copy,
I would think it would be correct, so if I'm getting the connection
correctly (as conn has a value), how would the connection be closed before i
get a chance to use it.
-- 
View this message in context: http://old.nabble.com/Connection-closed-err-in-code.-Dbus-send-works-fine-though-tp32140675p32141931.html
Sent from the Free Desktop - dbus mailing list archive at Nabble.com.



More information about the dbus mailing list