TransportBase#

class TransportBase[source]#

Bases: ABC

The contract a transport implements: _open_session, _teardown_session, is_open, plus shared ownership.

Ownership is deferred-teardown: opened by the first owner, torn down by the last. Holders are the objects that own the connection, so a device serving several categories holds the transport once on its own behalf and does its own device-level teardown before releasing.

Initialize holder tracking and the reentrant lock.

Attributes

is_open

Whether the underlying connection is currently open.

Methods

close

Close and teardown; with a holder, remove it and tear down only when the last owner leaves.

lock

Return the reentrant resource lock for atomic multi-step sequences; the holder may write/query/read inside it.

open

Open the connection (idempotent); with a holder, admit it and return True only for the first owner.