- if (remote_version < 23) {
- if (remote_version == 22 || (remote_version > 17 && am_sender))
- io_start_multiplex_out(f_out);
+ if (protocol_version < 23
+ && (protocol_version == 22 || am_sender))
+ io_start_multiplex_out(f_out);
+ else if (!ret) {
+ /* We have to get I/O multiplexing started so that we can
+ * get the error back to the client. This means getting
+ * the protocol setup finished first in later versions. */
+ setup_protocol(f_out, f_in);
+ io_start_multiplex_out(f_out);