Skip to content

Expose connection state #74

@hetelek

Description

@hetelek

Problem:
Currently, there is no variable or method to instantaneously check whether or not the dbus connection is alive. There is only bus.wait_for_disconnect(), which will wait for a disconnect rather than immediately return whether or not the connection is active.

Workaround:
One way to do this with the current release is bus._disconnect_future.done(), but this requires a private instance variable.

Proposal:
Expose a public variable or method that allows a user to check if the bus is connected. For example, bus.is_connected():

def is_connected() -> bool:
    return not self._disconnect_future.done()

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requesthelp wantedExtra attention is needed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions