Skip Menu |

This queue is for tickets about the Net-DBus CPAN distribution.

Report information
The Basics
Id: 22850
Status: resolved
Priority: 0/
Queue: Net-DBus

People
Owner: Nobody in particular
Requestors: tony [...] awtrey.com
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 0.33.4
Fixed in: (no value)



Subject: Connection close vs. unref in dbus-0.94
I'm trying to build this module on a current Debian Etch. I'm getting the following error when the tests are run: # t/30-server # Failed test 'client disconnected' # in t/30-server.t at line 38. The error is being cause by the fact that dbus-0.94 no longer allows connecting applications to call dbus_connection_close() on shared connections. The failing test follows after the attempt to close the connection (line 37) tries to verify that the connection is closed (line 38) and fails since it is still technically up. According to the dbus docs, the proper way for an application / client to terminate a connection is to call dbus_connection_unref instead of dbus_connection_disconnect. See the following doc references: http://dbus.freedesktop.org/doc/api/html/group__DBusConnection.html#ge130c33da29477897d362ab89f068191 http://dbus.freedesktop.org/doc/api/html/group__DBusConnection.html#gce42c9247692e466fb6bdeab82ccddc4 I added a simple unref function in lib/Net/DBus/Binding/Connection.pm and changed the test (t/30-server.t) to use it instead of the disconnect which dispenses with the warning. I also reversed the logic on the test to allow it to pass. BTW, this also allows the $server object to properly disconnect (and tear down its socket) without warnings about connection reference counts. I suggest that the disconnect on line 37 and the test on line 38 should probably be dropped since at least according to my reading of the docs, once a connection is opened by a client, the client should never explicitly close it, only unreference it and allow the owner / server process to close it during its destruction. You may also want to add an unref function like the one I've attached to this bug report. ...or I may be entirely wrong and should be mocked and ridiculed for my ignorance. Thanks anyway! Tony
Subject: add_unref.diff
--- ../libnet-dbus-perl-0.33.4.orig/lib/Net/DBus/Binding/Connection.pm 2006-11-05 16:47:57.000000000 -0500 +++ lib/Net/DBus/Binding/Connection.pm 2006-11-06 14:13:48.000000000 -0500 @@ -131,6 +131,18 @@ return $self->{connection}->dbus_connection_get_is_authenticated(); } +=item $con->unref() + +Unrefs this connection to the remote host. + +=cut + +sub unref { + my $self = shift; + + $self->{connection}->dbus_connection_unref(); +} + =item $con->disconnect()
Yes, the test suite itself is broken here - it should be using a private connection for the test rather than the shared connection. The main library code (as used by applications) though is working correctly - it was only the test case which is flawed. The next release will address the test case problem.
The new Net-DBus-0.33.5 release has been updated to make correct use of the close vs unref according to new DBus library semantics.