@@ -50,7 +50,7 @@ type Connection interface {
5050 Read (context.Context ) (JSONRPCMessage , error )
5151 Write (context.Context , JSONRPCMessage ) error
5252 Close () error // may be called concurrently by both peers
53- sessionID () string
53+ SessionID () string
5454}
5555
5656// A StdioTransport is a [Transport] that communicates over stdin/stdout using
@@ -95,7 +95,7 @@ type binder[T handler] interface {
9595
9696type handler interface {
9797 handle (ctx context.Context , req * JSONRPCRequest ) (any , error )
98- setSessionIDFunc ( func () string ) // so Sessions can get the session ID
98+ setConn ( Connection )
9999}
100100
101101func connect [H handler ](ctx context.Context , t Transport , b binder [H ]) (H , error ) {
@@ -126,7 +126,7 @@ func connect[H handler](ctx context.Context, t Transport, b binder[H]) (H, error
126126 },
127127 })
128128 assert (preempter .conn != nil , "unbound preempter" )
129- h .setSessionIDFunc (conn . sessionID )
129+ h .setConn (conn )
130130 return h , nil
131131}
132132
@@ -203,7 +203,7 @@ type loggingConn struct {
203203 w io.Writer
204204}
205205
206- func (c * loggingConn ) sessionID () string { return c .delegate .sessionID () }
206+ func (c * loggingConn ) SessionID () string { return c .delegate .SessionID () }
207207
208208// loggingReader is a stream middleware that logs incoming messages.
209209func (s * loggingConn ) Read (ctx context.Context ) (JSONRPCMessage , error ) {
@@ -290,7 +290,7 @@ func newIOConn(rwc io.ReadWriteCloser) *ioConn {
290290 }
291291}
292292
293- func (c * ioConn ) sessionID () string { return "" }
293+ func (c * ioConn ) SessionID () string { return "" }
294294
295295// addBatch records a msgBatch for an incoming batch payload.
296296// It returns an error if batch is malformed, containing previously seen IDs.
0 commit comments