new example code for multiple parallel ssl sessions using nonblocking I/O

DanKegel <[email protected]>
Newsgroups gmane.comp.mozilla.devel.nspr
Organization http://groups.google.com
Message-ID <b95478da-421b-4bbb-8dfa-85b7d564ca53@o40g2000prn.googlegroups.com>
Howdy!
This kind of belongs in the crypto group, but it's all about NSPR, so
I figured I'd post it here.

nss has two demo programs for SSL:
http://mxr.mozilla.org/mozilla-central/source/security/nss/cmd/tstclnt/tstclnt.c
http://mxr.mozilla.org/mozilla-central/source/security/nss/cmd/strsclnt/strsclnt.c
One demonstrates nonblocking I/O, but with only one session.
Another demonstrates many sessions, but with blocking I/O.

I'm writing a new example, taken mostly from tstclnt.c, that
demonstrates many sessions with nonblocking I/O.
A draft is at
  http://kegel.com/chromium/ptstclnt.patch
It behaves sensibly with a few clients; I have not yet tested it with
more than ten, and mostly I've been testing with two or three.

Can I get some feedback on how far this is from being good enough to
include in the trunk as another demo?
It isn't very efficient at maintaining the poll array, but maybe
that's ok for a demo.
I'm more worried about readability and bugs.
Thanks,
Dan

p.s. I'm doing this in preparation for another demo showing how to use
nspr i/o layers to let the caller do all his own networking instead of
letting nss/nspr do it
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.