User:Brahmana/Netwerk Docs/Channel Connection Relation: Difference between revisions

From MozillaWiki
Jump to navigation Jump to search
(made the numbered list)
No edit summary
Line 8: Line 8:
# When do actually things get multithreaded? Because the sequence flow here stops at EnsureWaiting(), when will it come out of waiting?
# When do actually things get multithreaded? Because the sequence flow here stops at EnsureWaiting(), when will it come out of waiting?


[For the first of those, if you go through the stuff in nsHttpConnectionMgr until you get to the call to nsHttpConnection::Activate.  This calls CreateTransport, whcih calls into the socket transport service, etc.  You'd need to trace into that to find the NSPR code that actually does the socket-opening, which is probably different on different OSes.  For the second, nsHttpConnectionMgr::AddTransaction (called when setting up the transaction) calls PostEvent, which dispatches the event to call OnMsgNewTransaction to the socket thread.  So there are basically two threads in play here, as I understand: the UI thread, where the asyncOpen happens, and the socket thread, where the socket access happens.  I think there is also a thread pool that comes into play later (from the stream transport service), but I'm not sure how that fits into the setup, to be honest.  --[[User:Bzbarsky|Bzbarsky]] 09:00, 9 July 2008 (PDT)]


There are a few, which I will put up once I have answers to these.
There are a few, which I will put up once I have answers to these.

Revision as of 16:00, 9 July 2008

Here is the sequence diagram that I created by tracing the code:

HTTPChannel to Socket.jpg

I have few questions regarding all this:

  1. Where is the socket opened and an actual TCP connection is made?
  2. When do actually things get multithreaded? Because the sequence flow here stops at EnsureWaiting(), when will it come out of waiting?

[For the first of those, if you go through the stuff in nsHttpConnectionMgr until you get to the call to nsHttpConnection::Activate. This calls CreateTransport, whcih calls into the socket transport service, etc. You'd need to trace into that to find the NSPR code that actually does the socket-opening, which is probably different on different OSes. For the second, nsHttpConnectionMgr::AddTransaction (called when setting up the transaction) calls PostEvent, which dispatches the event to call OnMsgNewTransaction to the socket thread. So there are basically two threads in play here, as I understand: the UI thread, where the asyncOpen happens, and the socket thread, where the socket access happens. I think there is also a thread pool that comes into play later (from the stream transport service), but I'm not sure how that fits into the setup, to be honest. --Bzbarsky 09:00, 9 July 2008 (PDT)]

There are a few, which I will put up once I have answers to these.