[Vortex] Race condition with auto-TLS

Jens Alfke jens at mooseyard.com
Tue Mar 4 21:39:14 CET 2008


I'm having trouble with race conditions, where apparently I'm trying  
to open a channel on an incoming connection before the TLS  
negotiations are completely finished. So now I'm trying to figure out  
how my code can be notified that the connection is ready to use.

It looks as though the callback for this is VortexTlsActivation. My  
problem is that the only API call that lets me register this callback  
is vortex_tls_start_negociation ... but I'm using auto-TLS, so I don't  
directly call that function, so I can't register the callback.

What I've been doing is registering a VortexTlsPostCheck callback via  
vortex_tls_set_default_post_check. After I return 'true' from that  
callback, I assume the connection's been TLS-ified and is ready to go.  
Except it isn't — the background thread doing the TLS setup still has  
to do a few more critical things like send greetings. So I still need  
to wait until it's done that.

Is there a way around this problem without turning off auto-TLS? (I'm  
using auto-TLS because the manual mechanism made the logic in my code  
too painful: it had to deal with the connection opening, and then  
closing-but-not-really, and then opening again but this time with TLS.  
I couldn't get my code to handle this correctly.)

Thanks...

—Jens
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 1875 bytes
Desc: not available
Url : http://lists.aspl.es/pipermail/vortex/attachments/20080304/f97b0755/attachment.bin 


More information about the Vortex mailing list