ginuerzh/gost · error
ssh-rtcp: connection is closed
Error message
ssh-rtcp: connection is closed
What it means
Returned by the SSH remote-forward (tcpip-forward) connector's ConnectContext when the session's connChan is closed, i.e. the accept loop feeding forwarded connections has exited and the channel was shut down. New inbound connections for the remote listener can no longer be delivered; either the session died or the forward was cancelled.
Source
Thrown at ssh.go:161
rc, err := ln.Accept()
if err != nil {
log.Logf("[ssh-rtcp] %s <-> %s accpet : %s", ln.Addr(), address, err)
return
}
// log.Log("[ssh-rtcp] accept", rc.LocalAddr(), rc.RemoteAddr())
select {
case cc.session.connChan <- rc:
default:
rc.Close()
log.Logf("[ssh-rtcp] %s - %s: connection queue is full", ln.Addr(), address)
}
}
}()
})
sc, ok := <-cc.session.connChan
if !ok {
return nil, errors.New("ssh-rtcp: connection is closed")
}
return sc, nil
}
type sshForwardTransporter struct {
sessions map[string]*sshSession
sessionMutex sync.Mutex
}
// SSHForwardTransporter creates a Transporter that is used by SSH port forwarding server.
func SSHForwardTransporter() Transporter {
return &sshForwardTransporter{
sessions: make(map[string]*sshSession),
}
}
func (tr *sshForwardTransporter) Dial(addr string, options ...DialOption) (conn net.Conn, err error) {
opts := &DialOptions{}View on GitHub (pinned to a33fdbf4c9)
Solutions
- Re-dial the SSH transport and re-request the remote port forward, then retry
- Check whether the accept goroutine exited because the SSH session closed or the listener errored
- Ensure only one consumer drains connChan so it is not closed prematurely
Defensive patterns
Strategy: retry
When it happens
Trigger: Thrown at ssh.go:161 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of ginuerzh/gost@a33fdbf4c9 (2026-09-02).
Data as JSON: /api/errors/2c9f3cc8e8963186.
Report an issue: GitHub.