(The Go Playground sometimes sees the TCP dial/listen as a deadlock. It will often work though.)
What did you expect to see?
The data from the peer, then io.EOF.
What did you see instead?
Partial data, and a write-related error. Usually write: broken pipe or write: protocol wrong type for socket
This only happens if the peer has closed the ssh.Conn (or the underlying transport). I believe the bug is rooted in an incorrect assumption here. The comment indicates that the channel should be tolerant of errors adjusting the window when the peer has closed the connection. The assumption is that such errors will be exclusively io.EOF. Perhaps something has changed, but this is not currently the case.
I'm actually not sure what the fix should be here as I'm not sure what error could be expected. I don't think net.Conn.Write makes any kind of guarantees about behavior when the peer has closed the connection. Somehow though, the buffered data should be returned to the reader, followed by io.EOF.
The text was updated successfully, but these errors were encountered:
It seems like there's another issue beyond the block of code I linked to above (this one). Even if you ignore the error returned by c.adjustWindow there, the Channel.Read call still sometimes returns an early io.EOF.