The attached patch against version 1.9.0 does two things:
1. Makes the write sockets non-blocking. We encountered issues with
rsync stalling repeatedly through a proxytunnel because both sides
were ready to read but neither side was able to write.
2. OpenSSL seems to get upset when the associated buffer with a non-
blocking write moves around, even when setting the appropriate MOVE
option. Rather than spend another few days trying to figure out what
I was missing in the OpenSSL API to make this correct, this patch
associates a write buffer with each PTSTREAM. When a write blocks,
subsequent stream_copy calls will attempt to flush the write buffer
first. This is potentially inefficient in the SSL data stream since
we really want to keep the encryption buffers full but I wasn't able
to figure out exactly when it was safe to move data within a buffer.
(See above.)
My apologies for gratuitously stomping on style and pre-existing API.
I was more interested in getting this to work than into a clean
project diff.
Non-blocking sockets patch