|
Sonde v1.1.0
Embeddable Model Context Protocol server for Qt applications
|
Shared state behind SessionRequest handles (design 0033). More...
#include <server_p.h>
Public Types | |
| using | Continuation = std::function<void(bool approved, const QString &reason)> |
| What happens on an answer: run on the sessions' thread, with whether the client is let in and, if not, why. | |
Public Member Functions | |
| bool | settle (bool approved, const QString &reason, bool byApplication) |
| Answers the request, unless it already was. | |
| bool | isAnswered () const |
| Whether it was answered. | |
| void | onCancelled (std::function< void()> callback) |
| Adds a callback for an answer that isn't the application's. | |
| void | arm (Continuation continuation, std::shared_ptr< HomeLink > home) |
| Sets what happens on the answer, and where cancel callbacks run. | |
Static Public Member Functions | |
| static SessionRequest | handle (std::shared_ptr< SessionRequestPrivate > state) |
A handle on state, for the application. | |
Public Attributes | |
| QJsonObject | clientInfo |
| From initialize. | |
| QString | transport |
| "local" or "http". | |
| SessionPeer | peer |
| What the operating system says. | |
Private Attributes | |
| std::mutex | m_mutex |
| Guards everything below. | |
| bool | m_answered = false |
| Whether it was answered. | |
| Continuation | m_continuation |
| What the answer does. | |
| std::shared_ptr< HomeLink > | m_home |
| Where cancel callbacks run. | |
| QList< std::function< void()> > | m_cancelHandlers |
| Run when it ends without an answer. | |
Shared state behind SessionRequest handles (design 0033).
Answered once: by the application (approve, deny), the timeout, or the client going away.
| bool Sonde::SessionRequestPrivate::settle | ( | bool | approved, |
| const QString & | reason, | ||
| bool | byApplication ) |
Answers the request, unless it already was.
byApplication is false for the timeout and a client that went away, which run the cancel callbacks.