Re: DBusServer accepted client close

Lawrence D'Oliveiro <ldo-kC51rjc0cqs1dNLGKZg6taU/[email protected]>
Newsgroups gmane.comp.freedesktop.dbus
Organization Geek Central
Message-ID <[email protected]>
On Fri, 5 Oct 2018 11:17:43 +0100, Simon McVittie wrote:

> That tells you when the connection has no more references. Sometimes
> that's what you want, but you do have to be careful not to create
> cyclic references that would keep the DBusConnection object in memory
> forever.

Yup, that’s the usual issue you have to watch for. The usual solution
is to use weak references somewhere in the cycle to break it. Or, in C
code, “borrowed” ones.

> Its primary use is to associate some state with a connection
> that will be freed eventually: for instance you might attach details
> of the client, like resources it has allocated in your server, to the
> connection so that you can easily deallocate them when it goes away.

I assumed that’s what the OP wanted.

> The other possible end point for a DBusConnection is when it has
> disconnected - the equivalent of read() or recv() returning 0 bytes
> (the end-of-file indicator) on a pipe or socket. libdbus guarantees
> that disconnection will be signalled by a special fake message being
> "received" by the connection, as though it had come from the client:

Thanks for that description. I have added the definition to DBussy:
<https://github.com/ldo/dbussy/commit/f674dd36dee4004db9522fede2175a744eac85d4>.
_______________________________________________
dbus mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dbus
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.