Event/Threading Model

From reSIProcate
Revision as of 09:36, 16 June 2005 by Jason (talk | contribs) (→‎process)
Jump to navigation Jump to search

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.


  • 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


  • 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?)


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


  • 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