diff options
| author | Rider Linden <rider@lindenlab.com> | 2026-09-24 13:53:34 -0700 |
|---|---|---|
| committer | Rider Linden <rider@lindenlab.com> | 2026-09-24 13:53:34 -0700 |
| commit | 020410f964f3be0b85fe62078281a43f75fa9585 (patch) | |
| tree | dfe647d6458ec8ea33a9f7eac59d359c72240675 /indra/llcorehttp/lljsonrpcws.h | |
| parent | 546782857fef92f1c745d58e30275138ee1e49f8 (diff) | |
Issue websocket hardening.
Diffstat (limited to 'indra/llcorehttp/lljsonrpcws.h')
| -rw-r--r-- | indra/llcorehttp/lljsonrpcws.h | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/indra/llcorehttp/lljsonrpcws.h b/indra/llcorehttp/lljsonrpcws.h index 08a6cefd22..98c858b022 100644 --- a/indra/llcorehttp/lljsonrpcws.h +++ b/indra/llcorehttp/lljsonrpcws.h @@ -284,10 +284,23 @@ public: * @param method The method name to call * @param params The parameters to pass * @param callback Callback for the response (optional) - * @return The request ID for correlation + * @param timeout Seconds before the callback is told the call timed out + * @return The request ID for correlation, undefined where it could not + * be sent (the callback is then never called) */ LLSD call(const std::string& method, const LLSD& params = LLSD(), - ResponseCallback callback = nullptr); + ResponseCallback callback = nullptr, F64 timeout = REQUEST_TIMEOUT_SECONDS); + + /** + * @brief Whether the peer's requests are dispatched + * + * A connection starts out unauthenticated and refuses every request as + * unauthorized, whether or not the method exists, until it is told the + * peer has proven itself -- e.g. by answering a challenge. Answers to + * its own calls go through either way: that is how the peer proves + * itself. + */ + bool isAuthenticated() const { return mAuthenticated.load(); } /** * @brief Send a JSON-RPC notification (no response expected) @@ -360,6 +373,8 @@ protected: */ LLSD generateId(); + void setAuthenticated(bool authenticated) { mAuthenticated = authenticated; } + public: /** * @brief Build a JSON-RPC 2.0 envelope. @@ -400,6 +415,8 @@ private: }; std::priority_queue<PendingDeadline> mPendingDeadlines; + std::atomic<bool> mAuthenticated{ false }; + static constexpr F64 REQUEST_TIMEOUT_SECONDS = 120.0; public: |
