Fix problem related to SSL buffering

There was a problem if OpenSSL accepted the last piece of the
data to be sent, but the socket library failed to accept it
(ewouldblock). This patch set's the ewouldblock in these
cases and retires the flushing of the buffer until it is done.

Change-Id: Icc2bba8d0d8b6870a0b303454bdedb28bd5527bc
Reviewed-on: http://review.couchbase.org/37512
Reviewed-by: Trond Norbye <trond.norbye@gmail.com>
Tested-by: Trond Norbye <trond.norbye@gmail.com>