[Gambas-user] gambas | Draft: DBus, add ConnectionExists boolean property (!238)
adamnt42 at gmail.com
Thu Jul 8 20:08:37 CEST 2021
On Thu, 2021-07-08 at 17:51 +0000, Bruce Steers (@bsteers4) wrote:
> Bruce Steers created a merge request: !238
> Project:Branches: bsteers4/gambas:dbus-connectionexists to
> Author: Bruce Steers
> NEW: ConnectionExists boolean property sets true if connection fails
> due to already existing connection.
> It's a solution. Or maybe just a workaround? With this if Register()
> fails and ConnectionExists = False i know i have a different error.
> I understand if you think it's not the best idea and you have a
> better idea :)
It's not the connection that is failing. It is the attempted
>From memory, checking whether a (any) dbus server already exists can be
done by simply trying to connect to it. BUT! as Benoit said, that is
not a "atomic" process.
The way he described is the best way to do such a "set and test" check.
except (set error)
else (do something else, like attempt to "become" the server*)
So it's actually failing successfully (!)
* a BAD idea imo. Servers should serve, clients should be simple and
! You also have the problem when using an asynchronous check in that
the server may well exit between the check and the subsequent attempt
to use that server.
More information about the User