| 1617 | } |
| 1618 | |
| 1619 | type streamableClientConn struct { |
| 1620 | url string |
| 1621 | client *http.Client |
| 1622 | ctx context.Context // connection context, detached from Connect |
| 1623 | cancel context.CancelFunc // cancels ctx |
| 1624 | incoming chan jsonrpc.Message |
| 1625 | maxRetries int |
| 1626 | strict bool // from [StreamableClientTransport.strict] |
| 1627 | logger *slog.Logger // from [StreamableClientTransport.logger] |
| 1628 | |
| 1629 | // disableStandaloneSSE controls whether to disable the standalone SSE stream |
| 1630 | // for receiving server-to-client notifications when no request is in flight. |
| 1631 | disableStandaloneSSE bool // from [StreamableClientTransport.DisableStandaloneSSE] |
| 1632 | |
| 1633 | // oauthHandler is the OAuth handler for the connection. |
| 1634 | oauthHandler auth.OAuthHandler // from [StreamableClientTransport.OAuthHandler] |
| 1635 | |
| 1636 | // Guard calls to Close, as it may be called multiple times. |
| 1637 | closeOnce sync.Once |
| 1638 | closeErr error |
| 1639 | done chan struct{} // signal graceful termination |
| 1640 | |
| 1641 | // Logical reads are distributed across multiple http requests. Whenever any |
| 1642 | // of them fails to process their response, we must break the connection, by |
| 1643 | // failing the pending Read. |
| 1644 | // |
| 1645 | // Achieve this by storing the failure message, and signalling when reads are |
| 1646 | // broken. See also [streamableClientConn.fail] and |
| 1647 | // [streamableClientConn.failure]. |
| 1648 | failOnce sync.Once |
| 1649 | _failure error |
| 1650 | failed chan struct{} // signal failure |
| 1651 | |
| 1652 | // Guard the initialization state. |
| 1653 | mu sync.Mutex |
| 1654 | initializedResult *InitializeResult |
| 1655 | sessionID string |
| 1656 | } |
| 1657 | |
| 1658 | var _ clientConnection = (*streamableClientConn)(nil) |
| 1659 |
nothing calls this directly
no outgoing calls
no test coverage detected