From 0d8454a1fc175228e16bfa827d72e3c4598f3394 Mon Sep 17 00:00:00 2001 From: Neil Booth Date: Tue, 2 Nov 2021 16:29:01 +0000 Subject: [PATCH 1/2] Clarify return value of run_in_process --- docs/reference.rst | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/reference.rst b/docs/reference.rst index fbb50b2..7a29a7a 100644 --- a/docs/reference.rst +++ b/docs/reference.rst @@ -790,7 +790,8 @@ foreign libraries. Use the following functions to do that: .. asyncfunction:: run_in_process(callable, *args) Run ``callable(*args)`` in a separate process and returns the - result. If cancelled, the underlying worker process is immediately + function's result (not the process exit code). If cancelled, + the underlying worker process is immediately cancelled by a ``SIGTERM`` signal. The given callable executes in an entirely independent Python interpreter and there is no shared global state. The separate process is launched using the "spawn" From 1c0f80dfc4fb082b7096d37da48a3ade0376dfb5 Mon Sep 17 00:00:00 2001 From: Neil Booth Date: Tue, 2 Nov 2021 16:49:15 +0000 Subject: [PATCH 2/2] Clarify behavior on authentication failure Note that Channel supports the async context manager protocol --- docs/reference.rst | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/docs/reference.rst b/docs/reference.rst index 7a29a7a..d56b6e0 100644 --- a/docs/reference.rst +++ b/docs/reference.rst @@ -1197,12 +1197,14 @@ The following methods are used to establish a connection on a :class:`Channel` i :header-rows: 0 * - ``await ch.accept(*, authkey=None)`` - - Wait for an incoming connection and return a + - Wait for an authenticated incoming connection and return a :class:`Connection` instance. *authkey* is an optional - authentication key. + authentication key. Connections failing authentication are logged + and dropped. * - ``await ch.connect(*, authkey=None)`` - Make an outgoing connection and return a :class:`Connection` instance. - *authkey* is an optional authentication key. + *authkey* is an optional authentication key. Raise AuthenticationError + if authentication fails. * - ``ch.bind()`` - Performs the address binding step of the ``accept()`` method. Use this to have the host operating system to assign a port @@ -1211,6 +1213,9 @@ The following methods are used to establish a connection on a :class:`Channel` i * - ``await ch.close()`` - Close the channel. +:class:`Channel` supports the asynchronous context manager protocol to call ``close()`` on +leaving the context. + The ``connect()`` and ``accept()`` methods of :class:`Channel` instances return an instance of the :class:`Connection` class: