MCPcopy Index your code
hub / github.com/coder/coder / requestReader

Method requestReader

provisionersdk/session.go:64–87  ·  view source on GitHub ↗
(done <-chan struct{})

Source from the content-addressed store, hash-verified

62}
63
64func (s *Session) requestReader(done <-chan struct{}) <-chan *proto.Request {
65 ch := make(chan *proto.Request)
66 go func() {
67 defer close(ch)
68 for {
69 req, err := s.stream.Recv()
70 if err != nil {
71 if !xerrors.Is(err, io.EOF) {
72 s.Logger.Warn(s.Context(), "recv done on Session", slog.Error(err))
73 } else {
74 s.Logger.Info(s.Context(), "recv done on Session")
75 }
76 return
77 }
78 select {
79 case ch <- req:
80 continue
81 case <-done:
82 return
83 }
84 }
85 }()
86 return ch
87}
88
89func (s *Session) handleRequests() error {
90 done := make(chan struct{})

Callers 1

handleRequestsMethod · 0.95

Calls 5

ContextMethod · 0.95
RecvMethod · 0.65
IsMethod · 0.45
ErrorMethod · 0.45
InfoMethod · 0.45

Tested by

no test coverage detected