It seems writing to non-blocking SSL sockets behaves somewhat strange... haven't understood it completely yet. Here is some detail http://readlist.com/lists/openssl.org/openssl-users/0/1794.html
Switching to a blocking socket would require a select call (otherwise we can't make sure our timeout works). Fixing SSL+NonBlocking would be preferable. I try to figure it out.