(ctx context.Context)
| 462 | } |
| 463 | |
| 464 | func (c *sseClientConn) Read(ctx context.Context) (jsonrpc.Message, error) { |
| 465 | select { |
| 466 | case <-ctx.Done(): |
| 467 | return nil, ctx.Err() |
| 468 | |
| 469 | case <-c.done: |
| 470 | return nil, io.EOF |
| 471 | |
| 472 | case data := <-c.incoming: |
| 473 | // TODO(rfindley): do we really need to check this? We receive from c.done above. |
| 474 | if c.isDone() { |
| 475 | return nil, io.EOF |
| 476 | } |
| 477 | msg, err := jsonrpc2.DecodeMessage(data) |
| 478 | if err != nil { |
| 479 | return nil, err |
| 480 | } |
| 481 | return msg, nil |
| 482 | } |
| 483 | } |
| 484 | |
| 485 | func (c *sseClientConn) Write(ctx context.Context, msg jsonrpc.Message) error { |
| 486 | data, err := jsonrpc2.EncodeMessage(msg) |
nothing calls this directly
no test coverage detected