On Thu, 20 Mar 2003 11:45:28 -0700, Verdon Walker wrote: >I knew I had not explained myself well enough given your last >response. >I did not mean to attempt to abort the "current chunck", but rather >to >be able to read the cancel between chunks so I could do just what >you >suggest. Of course, the definition of "current chunk" is part of my >problem. I was thinking of the fact that when I do an SSL_write on a >very large buffer, OpenSSL breaks it up into 16k pieces. Can I >somehow >do a read in between writing those 16k pieces or do I have to step >back >and do it between just between the "chunks" I sent to OpenSSL >through >SSL_write?
Now I'm really puzzled. First you want OpenSSL to provide semantics like normal TCP sockets. Now you want more access to SSL internals such as the 16Kb chunks it uses internally. Which way do you want it? >BTW, we are using non-blocking sockets so I could clearly read from >the >socket between socket writes, but if I SSL_read from the socket >during a >long SSL_write operation, I am asking for trouble (with the internal >state) so I don't think I can do the synchronization down at the BIO >level unless I am still missing a big piece of the puzzle. If you're using non-blocking sockets, there are no "long SSL_write operation"s. If you have data to write and you can write, then write. If there's data to read, read it from the socket and see if it has application data. Basically, all you have to do is *not* call SSL_write with large chunks as a blocking operation. If you did this, you couldn't abort them no matter what anyway as you'd kill the protocol you're layering on top of SSL, so I don't even understand why there's an issue. >Thanks again for taking the time to respond to my questions. Your >feedback is very helpful. > >I apologize that this discussion has taken on a "user" tone rather >than >a "developer" tone. That was not my original intent. I have to admit I'm utterly baffled as to what you want to do. If all your writes are non-blocking, you can easily read between writes. For example, you can code a 'write' function that works as follows: 1) Acquire a single mutex for this connection. 2) Attempt a non-blocking SSL write. 3) Release the mutex. 4) If all data was written, return. 5) Otherwise, 'select' on the socket for writing, then jump to step 1 when 'select' returns. Then you can code a 'read' function that works as follow: 1) Acquire the single mutex for this connection. 2) Check if SSL_read has any processed data to be read (allowing it to read the socket but not block). 3) Release the mutex. If data was read, return. 4) 'select' on the socket for reading, optionally with a timeout. Then either return or jump to step 1. This will give you either non-blocking or blocking semantics and will allow you to call 'read' and 'write' at the same time without a problem. I don't understand exactly what semantics you want, but whatever they are, you can code them. DS ______________________________________________________________________ OpenSSL Project http://www.openssl.org Development Mailing List [EMAIL PROTECTED] Automated List Manager [EMAIL PROTECTED]