Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a dedicated method for disconnecting TLS connections #10005

Draft
wants to merge 6 commits into
base: master
Choose a base branch
from

Commits on Feb 16, 2024

  1. AsioTlsStream: inherit from SharedObject

    All usages of `AsioTlsStream` were already using `Shared<AsioTlsStream>` to
    keep a reference-counted instance. This commit moves the reference counting to
    `AsioTlsStream` itself by inheriting from `SharedObject`. This will allow to
    implement methods making use of the fact that these objects are
    reference-counted.
    
    The changes outside of `lib/base/tlsstream.hpp` are merely replacing
    `Shared<AsioTlsStream>::Ptr` with `AsioTlsStream::Ptr` everywhere.
    julianbrost committed Feb 16, 2024
    Configuration menu
    Copy the full SHA
    0ff5002 View commit details
    Browse the repository at this point in the history
  2. AsioTlsStream: add GracefulDisconnect() and ForceDisconnect()

    Calling `AsioTlsStream::async_shutdown()` performs a TLS shutdown which
    exchanges messages (that's why it takes a `yield_context`) and thus has the
    potential to block the coroutine. Therefore, it should be protected with a
    timeout. As `async_shutdown()` doesn't simply take a timeout, this has to be
    implemented using a timer. So far, these timers are scattered throughout the
    codebase with some places missing them entirely. This commit adds helper
    functions to properly shutdown a TLS connection with a single function call.
    julianbrost committed Feb 16, 2024
    Configuration menu
    Copy the full SHA
    57c6ba7 View commit details
    Browse the repository at this point in the history
  3. ApiListener: use AsioTlsStream::GracefulDisconnect()

    This new helper functions allows deduplicating the timeout handling for
    `async_shutdown()`.
    julianbrost committed Feb 16, 2024
    Configuration menu
    Copy the full SHA
    1bda8cc View commit details
    Browse the repository at this point in the history
  4. HttpServerConnection: use AsioTlsStream::GracefulDisconnect()

    This new helper function has proper timeout handling which was missing here.
    julianbrost committed Feb 16, 2024
    Configuration menu
    Copy the full SHA
    d64d7dc View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    d6953cc View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    e90acc5 View commit details
    Browse the repository at this point in the history