MCPcopy Index your code
hub / github.com/cli/cli / handleChannels

Function handleChannels

internal/codespaces/connection/tunnels_api_server_mock.go:389–409  ·  view source on GitHub ↗
(ctx context.Context, server *relayServer, chans <-chan ssh.NewChannel)

Source from the content-addressed store, hash-verified

387}
388
389func handleChannels(ctx context.Context, server *relayServer, chans <-chan ssh.NewChannel) error {
390 errc := make(chan error, 1)
391 go func() {
392 for ch := range chans {
393 if handler, ok := server.channels[ch.ChannelType()]; ok {
394 if err := handler(ctx, ch); err != nil {
395 errc <- err
396 return
397 }
398 } else {
399 // generic accept of the channel to not block
400 _, _, err := ch.Accept()
401 if err != nil {
402 errc <- fmt.Errorf("error accepting channel: %w", err)
403 return
404 }
405 }
406 }
407 }()
408 return awaitError(ctx, errc)
409}
410
411func handleRequests(ctx context.Context, reqs <-chan tunnelssh.SSHRequest) {
412 for {

Callers 1

makeConnectionFunction · 0.85

Calls 2

awaitErrorFunction · 0.85
ErrorfMethod · 0.65

Tested by

no test coverage detected