-
Notifications
You must be signed in to change notification settings - Fork 98
Open
Description
First of all thanks a lot for this lib, helps a lot writing stuff for apple ecosystem.
As far as I understand from apple documentation, SSLWrite() will call SSLWriteFunc(), but if there is any kind of error returned by SSLWriteFunc(), SSLWrite() itself will return an error of its own, ie there is no responsibility the coder has to "save" the error returned by SSLWriteFunc() and then check that after calling SSLWrite() etc.. In fact, doing that might be erroneous - consider this example.
- We called SSLWrite(), SSLWriteFunc() might have returned errSslWouldBlock, but SSLWrite() itself succeeded because SSL lib is gonna buffer up the data we provide (and encrypt it and call SSLWriteFunc() on the encrypted data) - so the library has now "cached" an error errSslWouldBlock in conn.err
- Later again we call SSLWrite(), this time just as an example say there was some error and the API returned errSSLPeerCertExpired
- Now write() will go and check conn.err and will find errSslWouldBlock and that is what the caller to write() gets as an error, which is incorrect
So in summary, IMO there is no need to cache conn.err and return it - unless there was a reason for it, which ill be curious to know
Metadata
Metadata
Assignees
Labels
No labels