I agree that we should use nonblocking I/O instead of one-thread-per-connection.

On Tue, Sep 16, 2008 at 9:42 AM, Dan Kegel <[EMAIL PROTECTED]> wrote:
>
> There's another design choice to make:
> whether to write an NSPR I/O layer so we can use
> our own TCPClientSocket for all network I/O,
> or bypass TCPClientSocket and let nss do its
> own I/O.  Wan-teh suggests the latter is easier in
> http://developer.mozilla.org/En/PR_ImportTCPSocket
> but I think that requires us to use
> http://developer.mozilla.org/en/PR_Poll to do
> I/O multiplexing in MessagePumpForIO,
> and to base TCPClientSocket on NSPR.

No, you don't need to use PR_Poll to do
I/O multiplexing.  You can call the 'poll' method
of PRFileDesc directly and use the native poll
or epoll system call to do I/O multiplexing.
(This is how PR_Poll is implemented.)  The
'poll' method is defined at
http://mxr.mozilla.org/nspr/ident?i=PRPollFN

The 'poll' method tells you whether the fd is already
readable or writable (this is possible if the PRFileDesc
has an internal read or write buffer), and if not, what
poll flags you should use with the underlying native
fd in your own I/O multiplexing loop.

I will add some documentation of the 'poll'
method to the NSPR wiki and ask you to
review it.

> I think the next step might be for me to write an
> app demonstrating how to handle 500
> simultanous ssl connections using nss and libevent.
> Having done this once before with openssl,
> I expect this will be a pain.  But what the heck,
> it should be fun, too.

This sounds like fun :-)  I think this app would be
a useful code example for NSS, too.

The two NSS SSL client test programs are:
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

tstclnt.c ("test client") is a simple SSL test client, which
uses NSS in non-blocking mode.

strsclnt.c ("stress client") is an SSL client for stress tests.
It uses NSS in blocking mode.

Wan-Teh

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Chromium-dev" group.
To post to this group, send email to chromium-dev@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/chromium-dev?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to