Comment 5 for bug 819604

Revision history for this message
Martin Pool (mbp) wrote : Re: when an idle ssh transport is interrupted, bzrlib errors

The medium is a fairly thin wrapper around the socket/pipes for the connection. It seems it would be reasonable to either have the medium reconnect, or to throw away the medium and make a new one.

There are several _accept_bytes implementations; the most relevant ones here are SmartTCPClientMedium and (especially for Launchpad) SmartSSHClientMedium.

We can't just reconnect at arbitrary points in the protocol, only at the start of a request. The medium itself doesn't know about request boundaries so the higher-level client needs to be involved.

Retrying may be a bit complex if we're planning to send streaming data coming from a generator; so ideally we will find that the connection was closed and restart before we start taking anything from a generator. We could just leave this case unhandled and deal with it if it does come up: it wasn't here.

An alternative approach might be check if the pipe/socket has closed before we try to write the start of a request. In the case that the remote end has timed out and closed the socket and we are using an external ssh it will probably have already noticed this.