| 667 | } |
| 668 | |
| 669 | type streamableServerConn struct { |
| 670 | sessionID string |
| 671 | stateless bool |
| 672 | jsonResponse bool |
| 673 | eventStore EventStore |
| 674 | |
| 675 | logger *slog.Logger |
| 676 | |
| 677 | incoming chan jsonrpc.Message // messages from the client to the server |
| 678 | |
| 679 | mu sync.Mutex // guards all fields below |
| 680 | |
| 681 | // Sessions are closed exactly once. |
| 682 | isDone bool |
| 683 | done chan struct{} |
| 684 | |
| 685 | // Sessions can have multiple logical connections (which we call streams), |
| 686 | // corresponding to HTTP requests. Additionally, streams may be resumed by |
| 687 | // subsequent HTTP requests, when the HTTP connection is terminated |
| 688 | // unexpectedly. |
| 689 | // |
| 690 | // Therefore, we use a logical stream ID to key the stream state, and |
| 691 | // perform the accounting described below when incoming HTTP requests are |
| 692 | // handled. |
| 693 | |
| 694 | // streams holds the logical streams for this session, keyed by their ID. |
| 695 | // |
| 696 | // Lifecycle: streams persist until all of their responses are received from |
| 697 | // the server. |
| 698 | streams map[string]*stream |
| 699 | |
| 700 | // requestStreams maps incoming requests to their logical stream ID. |
| 701 | // |
| 702 | // Lifecycle: requestStreams persist until their response is received. |
| 703 | requestStreams map[jsonrpc.ID]string |
| 704 | } |
| 705 | |
| 706 | func (c *streamableServerConn) SessionID() string { |
| 707 | return c.sessionID |
nothing calls this directly
no outgoing calls
no test coverage detected