[Mono-dev] [PATCH] Fully Asynchronous and Re-Factored Ssl Streams in Mono.Security

JD Conley jd.conley at coversant.net
Thu Aug 25 00:12:49 EDT 2005


I took the plunge and fully implemented async Ssl streams for both client and server.  This fixes http://bugzilla.ximian.com/show_bug.cgi?id=75687 as well as other bugs I've been talking with Sebastien and Carlos about off list. This patch passes the SocketHell tests that I contributed to them last week (multi threaded concurrent async streaming through TCP sockets).

It's also a bit of a re-factor, though I only touched two classes and added one.  I pulled most of the code out of the individual SslClientStream and SslServerStream and moved it down into a new abstract SslStreamBase.  Client and server are now practically the same implementation.  I left all existing interfaces present, but obviously had to add some new ones.

The only "gotcha" is if you start running low on threadpool threads. Then the Ssl Stream will fall back to a synchronous handshake. The other option here is to spawn a thread ourselves for the handshake instead of using Delegate.BeginInvoke(), use the IO ThreadPool (is that available to Mono.Security?), or just live with a synchronous handshake. Of course, 99.999% of the time this issue won't occur and won't be a problem unless you have both client and server sharing the same Threadpool causing a deadlock.

I hope this helps and gets integrated.  It's definitely necessary for our implementation.

-JD Conley
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Mono.Security.zip
Type: application/x-zip-compressed
Size: 14360 bytes
Desc: Mono.Security.zip
Url : http://lists.ximian.com/pipermail/mono-devel-list/attachments/20050824/573ee745/attachment.bin 


More information about the Mono-devel-list mailing list