User:Brahmana/Netwerk Docs/Netwerk Request Life Cycle
Here is the sequence diagram that I created by tracing the code:
I have few questions regarding all this:
- Where is the socket opened and an actual TCP connection is made?
- 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)]
[HTTP doesn't use the stream transport service. Also, shouldn't gHttpHandler be the connection manager instead, in the diagram? The diagram also sort of skips the more interesting parts of the HTTP code (i.e. the parts that actually write the data into the pipe) --Biesi 10:47, 9 July 2008 (PDT)]
There are few more questions , which I will put up once I have answers to these.