MCPcopy Create free account
hub / github.com/cli/cli / handleChannels

Function handleChannels

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

Source from the content-addressed store, hash-verified

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

Callers 1

makeConnectionFunction · 0.85

Calls 2

awaitErrorFunction · 0.85
ErrorfMethod · 0.65

Tested by

no test coverage detected