pub struct ConnectionInner {Show 13 fields
pub http_client: Client,
pub url: String,
pub session_id: String,
pub headers: IndexMap<String, String>,
pub extra_headers: RwLock<IndexMap<String, String>>,
pub backoff_current_interval: Duration,
pub backoff_initial_interval: Duration,
pub backoff_randomization_factor: f64,
pub backoff_multiplier: f64,
pub backoff_max_interval: Duration,
pub backoff_max_elapsed_time: Duration,
pub call_timeout: Duration,
pub initialize_result: InitializeResult,
/* private fields */
}Expand description
The actual connection state. Behind an Arc inside Connection.
Fields are public for read-only access (callers reach them via
Connection’s Deref), but every method on this type is private —
the public surface lives on Connection and delegates through.
Fields§
§http_client: Client§url: String§session_id: String§headers: IndexMap<String, String>All HTTP headers stamped on every POST / GET this connection
makes — the same merged map (defaults + caller overrides) the
Client built once during connect. Mcp-Session-Id,
Content-Type, and Accept are still set by the request
builders and override anything in headers.
extra_headers: RwLock<IndexMap<String, String>>Mutable per-request override layer stamped AFTER headers on
every outbound HTTP request. The request-builder uses
reqwest::header::HeaderMap::insert semantics so any key
present in extra_headers REPLACES the same key in headers.
Used by the proxy to inject session-global headers
(X-OBJECTIVEAI-RESPONSE-ID etc.) that override per-URL
values without re-dialing. Empty by default; set via
Connection::set_extra_headers.
backoff_current_interval: Duration§backoff_initial_interval: Duration§backoff_randomization_factor: f64§backoff_multiplier: f64§backoff_max_interval: Duration§backoff_max_elapsed_time: Duration§call_timeout: Duration§initialize_result: InitializeResultThe server’s capabilities and info from the initialize response.
Trait Implementations§
Source§impl Debug for ConnectionInner
impl Debug for ConnectionInner
Source§impl Drop for ConnectionInner
impl Drop for ConnectionInner
Source§fn drop(&mut self)
fn drop(&mut self)
Orphan-DELETE hook: when a freshly-minted connection (not a
resume) is dropped without any deliberate use — no call_tool,
no read_resource, no explicit Connection::delete — spawn a
fire-and-forget HTTP DELETE so the upstream session we just
opened doesn’t sit there accruing per-session state for nothing.
Reconnect-resumes are deliberately excluded: a reconnect’s
any_calls == false only means this Connection instance
never called anything — the underlying upstream session may
well have been used by an earlier Connection that opened it,
did real work, and let us re-attach. Tearing it down here would
kill a still-live session out from under whoever owns it.
Reconnects rely on the proxy’s explicit Connection::delete
(or Client::delete) for upstream cleanup instead.
Skip conditions (any one triggers a no-op):
mockistrue— there was never an HTTP session to begin with.is_reconnectistrue— see above; the upstream session pre-existed this connection and isn’t ours to tear down on drop.any_callsistrue— the connection was deliberately used, or an explicitConnection::deletealready ran.- No tokio runtime is in scope —
tokio::spawnwould panic. Silently leak the upstream session in this case (sync teardown paths e.g.cfg(test)blocks not driven by tokio).
The listener-cancel DropGuard inside _listener_cancel_guard
fires automatically as part of this same drop call, so by the
time the orphan DELETE goes out the listener task has already
been told to cancel — no SSE/GET race with the upstream DELETE.
Auto Trait Implementations§
impl !Freeze for ConnectionInner
impl !RefUnwindSafe for ConnectionInner
impl !UnwindSafe for ConnectionInner
impl Send for ConnectionInner
impl Sync for ConnectionInner
impl Unpin for ConnectionInner
impl UnsafeUnpin for ConnectionInner
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more