{"record":{"id":"2c9f3cc8e8963186","repo":"ginuerzh/gost","slug":"ssh-rtcp-connection-is-closed","errorCode":null,"errorMessage":"ssh-rtcp: connection is closed","messagePattern":"ssh-rtcp: connection is closed","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"ssh.go","lineNumber":161,"sourceCode":"\t\t\t\trc, err := ln.Accept()\n\t\t\t\tif err != nil {\n\t\t\t\t\tlog.Logf(\"[ssh-rtcp] %s <-> %s accpet : %s\", ln.Addr(), address, err)\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\t// log.Log(\"[ssh-rtcp] accept\", rc.LocalAddr(), rc.RemoteAddr())\n\t\t\t\tselect {\n\t\t\t\tcase cc.session.connChan <- rc:\n\t\t\t\tdefault:\n\t\t\t\t\trc.Close()\n\t\t\t\t\tlog.Logf(\"[ssh-rtcp] %s - %s: connection queue is full\", ln.Addr(), address)\n\t\t\t\t}\n\t\t\t}\n\t\t}()\n\t})\n\n\tsc, ok := <-cc.session.connChan\n\tif !ok {\n\t\treturn nil, errors.New(\"ssh-rtcp: connection is closed\")\n\t}\n\treturn sc, nil\n}\n\ntype sshForwardTransporter struct {\n\tsessions     map[string]*sshSession\n\tsessionMutex sync.Mutex\n}\n\n// SSHForwardTransporter creates a Transporter that is used by SSH port forwarding server.\nfunc SSHForwardTransporter() Transporter {\n\treturn &sshForwardTransporter{\n\t\tsessions: make(map[string]*sshSession),\n\t}\n}\n\nfunc (tr *sshForwardTransporter) Dial(addr string, options ...DialOption) (conn net.Conn, err error) {\n\topts := &DialOptions{}","sourceCodeStart":143,"sourceCodeEnd":179,"githubUrl":"https://github.com/ginuerzh/gost/blob/a33fdbf4c98034f4bfeeaea9868909822b9c526d/ssh.go#L143-L179","documentation":"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.","triggerScenarios":"Thrown at ssh.go:161 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","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"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"a33fdbf4c98034f4bfeeaea9868909822b9c526d","analyzedAt":"2026-09-02T22:15:54.506Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-10T02:17:09.455Z"}