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

Method Close

internal/codespaces/connection/connection.go:111–126  ·  view source on GitHub ↗

Close closes the underlying tunnel client SSH connection.

()

Source from the content-addressed store, hash-verified

109
110// Close closes the underlying tunnel client SSH connection.
111func (c *CodespaceConnection) Close() error {
112 // Lock the mutex to prevent race conditions with the underlying SSH connection
113 c.TunnelClient.mu.Lock()
114 defer c.TunnelClient.mu.Unlock()
115
116 // Don't close if we're not connected
117 if c.TunnelClient != nil && c.TunnelClient.connected {
118 if err := c.TunnelClient.Close(); err != nil {
119 return fmt.Errorf("failed to close tunnel client connection: %w", err)
120 }
121
122 c.TunnelClient.connected = false
123 }
124
125 return nil
126}
127
128// getTunnelManager creates a tunnel manager for the given codespace.
129// The tunnel manager is used to get the tunnel hosted in the codespace that we

Callers 1

Calls 2

CloseMethod · 0.65
ErrorfMethod · 0.65

Tested by 1