The only way I know of to solve this problem is to use non-blocking sockets,
create a second socket pair to deliver the terminate message, and select()
on the SSL socket and the terminate socket.  When thread#2 wants to
terminate thread#1 it sends a message down the terminate socket which causes
the select to wakeup.  At this point you can check if the readable event was
on the terminate socket and if so abort the connection.  If none of this
makes any sense you might want to search the web for information on
non-blocking sockets and select() and then search the OpenSSL mailing lists
for related info.  Note, on Unix you'd probably use a pipe() instead of a
socket pair for the terminate socket, but you can't do that on Win32 because
Win32 can't select() on pipes.

Regards,

Steven

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]]On Behalf Of Jem
Sent: Wednesday, 19 February 2003 10:55 AM
To: [EMAIL PROTECTED]
Subject: Multithreaded; how to abort during read?


In my test program (on win32, using OpenSSL 0.9.7 DLLs) I have two threads
running:

Thread #1 is busy doing a SSL_read()
Thread #2 wants to abort the SSL connection

When I make Thread #2 do "SSL_shutdown", the program crashes. Is there a
'gentle' way to do this, perhaps by having Thread #2 set a flag in the SSL
stucture that tells SSL_read, SSL_write to abort whatever they're doing?
Then
Thread #1 can do the actual SSL_shutdown when the time is right?

Any suggestions greatly appreciated.


______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    [EMAIL PROTECTED]
Automated List Manager                           [EMAIL PROTECTED]

______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    [EMAIL PROTECTED]
Automated List Manager                           [EMAIL PROTECTED]

Reply via email to