Re: Non-blocking SSLWrite problems
Re: Non-blocking SSLWrite problems
- Subject: Re: Non-blocking SSLWrite problems
- From: Brian Webster <email@hidden>
- Date: Wed, 12 Oct 2005 12:30:02 -0500
On Oct 12, 2005, at 12:08 PM, Rich Siegel wrote:
As far as I know, the SSLWriteProc should never return
errSSLWouldBlock,
and in fact none of mine ever do. Your SSLWriteProc should push the
data
at the socket, set *dataLength to the actual amount of data that was
actually transmitted, and only return an error if you want the whole
process to abort.
The way the docs are written implies that you should be able to
return errSSLWouldBlock. From the discussion of the SSLWriteFunc
callback:
"You may configure the underlying connection to operate in a
nonblocking manner. In that case, a write operation may well return
errSSLWouldBlock, indicating less data than requested was transferred
and nothing is wrong except that the requested I/O hasn’t completed.
This result is returned to the caller from the functions SSLRead,
SSLWrite, or SSLHandshake."
Reading this, it really seems like you should be able to return
errSSLWouldBlock from the callback, and then that error code is
passed through as the result of SSLWrite.
The problem with waiting inside the write callback is that, due to
SSLRead/SSLWrite not being thread safe (which I learned the hard
way), I would not be able to perform any reads while I'm waiting
inside SSLWrite to push data over the socket, which (at least in my
program) can lead to a deadlock situation.
OpenSSL is starting to look better and better...
--
Brian Webster
email@hidden
http://homepage.mac.com/bwebster/
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Macnetworkprog mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden