ssh: libssh2_channel_write() behaves like send()

When the stream writing function was written, it assume that
libssh2_channel_write() would always write all of the data to the
wire. This is only true for the first 32k of data, which it tries to
fit into one ssh packet.

Since it can perform short writes, call it in a loop like we do for
send(), advancing the buffer offset.

From #2454