Wow! That works great, and in my tests with a 500MB repo, cloning took 133s vs 234s with the library we currently using (and that is native code).
Interestingly, changing the buffer size didn't make much difference to performance.
I guess my only question on this now is what do you suggest for error handling. If I abort the clone from the client side then I see this in the log :
2017-03-08 14:38:31.646 ERROR FileServer(1)[18] SSH: Session 1: Error while sending packet data: System.Net.Sockets.SocketException (0x80004005): An existing connection was forcibly closed by the remote host
at System.Net.Sockets.Socket.Send(Byte[] buffer, Int32 offset, Int32 size, SocketFlags socketFlags)
at Rebex.Net.UNZ.D(Byte[] V, Int32 T, Int32 Q)
at Rebex.Net.Protocols.Ssh.OGZ.JG(UTZ V)
2017-03-08 14:38:31.653 ERROR ShellModule(1)[18] Server: Session 1: Error: Rebex.Net.Protocols.Ssh.QZZ: Error while sending packet data.
at Rebex.Net.Protocols.Ssh.OGZ.JG(UTZ V)
at Rebex.Net.Protocols.Ssh.STZ.KT(Int32 V, Byte[] T, Int32 Q, Int32 Z)
at Rebex.Net.Protocols.Ssh.STZ.KT(Byte[] V, Int32 T, Int32 Q)
at Rebex.Net.Protocols.AZZ.YI(Nullable`1 V, Stream T, Byte[] Q)
Error: Rebex.Net.Protocols.Ssh.QZZ: Error while sending packet data.
at Rebex.Net.Protocols.Ssh.OGZ.JG(UTZ V)
at Rebex.Net.Protocols.Ssh.STZ.KT(Int32 V, Byte[] T, Int32 Q, Int32 Z)
at Rebex.Net.Protocols.Ssh.STZ.KT(Byte[] V, Int32 T, Int32 Q)
at Rebex.Net.Protocols.AZZ.YI(Nullable`1 V, Stream T, Byte[] Q)
The server however does stay up and continue to function normally.