Difference between revisions of "Event/Threading Model"

From reSIProcate
Jump to navigation Jump to search
 
Line 17: Line 17:
 
* after select returns, pass the now marked up FdSet to SipStack::process
 
* after select returns, pass the now marked up FdSet to SipStack::process
 
* process delegates to anything in the SipStack that needs cycles periodically
 
* process delegates to anything in the SipStack that needs cycles periodically
 +
** ask the StatisticsManager to generate its stats
 +
** ask the Transports to send/receive and accept new connections
 +
** give the dns provider / cache cycles
 +
** process App and Transaction Timers
 +
** handle all outstanding events affecting [[TransactionState]]

Revision as of 10:36, 16 June 2005

The threading model in the stack requires the application to build an FdSet and call process on the stack. The select call needs a timeout value which the stack can also determine. The application may need to add its own file descriptors and timers as well.

buildFdSet

  • anything in the stack or the application that uses a file descriptor needs to add itself to the FdSet
  • this should start with an empty FdSet
  • next call SipStack::buildFdSet and this will add the file descriptors for all of the transports, connections and the dns provider
  • next add any application file descriptors

getTimeTillNextProcess

  • determines the minimum time till any timer in the application or stack will fire
  • if anything in the stack needs to process immediately, short circuit and return 0. (Currently, the dns provider short circuits with a value of 50ms?)

select

  • call select either in the Application or in a StackThread and pass in the two things constructed above

process

  • after select returns, pass the now marked up FdSet to SipStack::process
  • process delegates to anything in the SipStack that needs cycles periodically
    • ask the StatisticsManager to generate its stats
    • ask the Transports to send/receive and accept new connections
    • give the dns provider / cache cycles
    • process App and Transaction Timers
    • handle all outstanding events affecting TransactionState