You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
The text was updated successfully, but these errors were encountered:
Sure, I will attempt a test case. But does my line of reasoning sound logical ? Leaving aside all the Rust wrappers, the matter under discussion here is simply "should SSLWriteFunc() error be saved, should callers of SSLWrite() check for the saved error ?" and to me it sounds that the obvious answer is no, because SSLWrite() itself can/will check for the error return on SSLWriteFunc() and translate/return that appropriately as needed. What I was curious to know is whether there is a specific reason you have done so in the rust code or it was just something that was not necessarily for handling anything particular
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.
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
The text was updated successfully, but these errors were encountered: