< Previous by Date Date Index Next by Date >
< Previous in Thread Thread Index Next in Thread >

RE: [reSIProcate] DUM shutdown message processing


The DUM graceful shutdown is designed to notify the user when all DialogSets
have been terminated.  It makes more sense to shutdown the DUM before
shutting down the stack, as Scott proposed.

That said I want to do a little requirements gathering on this issue.  Here
are some use cases.

1.) The app wants to shutdown the stack right away and doesn't care about
all Dialogs being terminated.

To do this simply delete the DUM then the SipStack(if desired)

2.) The app wants to gracefully terminate(or wait for natural death) all
exiting Dialogs/DialogSets in the dum, but possibly wants to keep the
SipStack.  

Call DialogUsageManager::shutdown(), wait for onDumCanBeDeleted.

3.) The apps wants to gracefully terminate the DUM and the SipStack.

We could add a parameter to DialogUsageManager::shutdown which indicates
that the SipStack should also be shut down.  When all of DUM's dialogs are
teminated, dum will shutdown the SipStack, then call onDumCanBeDeleted.
There could be another callback/overload to indicate that the SipStack has
been shut down.

--Derek



> -----Original Message-----
> From: resiprocate-devel-bounces@xxxxxxxxxxxxxxxxxxx [mailto:resiprocate-
> devel-bounces@xxxxxxxxxxxxxxxxxxx] On Behalf Of Scott Godin
> Sent: Tuesday, September 14, 2004 10:34 AM
> To: 'kaiduan xie'; resiprocate-devel@xxxxxxxxxxxxxxxxxxx
> Subject: RE: [reSIProcate] DUM shutdown message processing
> 
> DUM should be shutdown before the stack is shutdown.  I would recommend
> the
> following shutdown procedure.
> 1.  Call dum->shutdown().
> 2.  Call cancel() on any active DUM dialogsets.  (or just wait for
> DialogSets to end - if graceful shutdown).
> 3.  Continue calling process on DUM until onDumCanBeDeleted callback is
> called.  This allows all DUM objects to clean themselves up.
> 4.  Delete DUM object if desired.
> 5.  Call stack->shutdown().
> 6.  Call process on the stack until the Shutdown message is seen. Ie:
> 
> ... Shutdown dum...
> 
> delete m_dum;
> m_dum = NULL;
> 
> // Shutdown stack and wait for it to complete
> m_stack->shutdown();
> BOOL fStackShutdown = FALSE;
> while(!fStackShutdown)
> {
>       FdSet fdset;
>       m_stack->buildFdSet(fdset);
>       fdset.selectMilliSeconds(50);
>       m_stack->process(fdset);
>       Message *msg = m_stack->receiveAny();
>       if(msg)
>       {
>               SipMessage *sip;
>               ShutdownMessage *shutdown;
>               if((shutdown=dynamic_cast<ShutdownMessage*>(msg)))
>               {
>                       fStackShutdown = TRUE;
>               }
>               delete msg;
>       }
> }
> delete m_stack;
> m_stack = NULL;
> 
> I hope this helps.
> 
> -----Original Message-----
> From: kaiduan xie [mailto:kaiduanx@xxxxxxxx]
> Sent: Tuesday, September 14, 2004 1:07 PM
> To: resiprocate-devel@xxxxxxxxxxxxxxxxxxx
> Subject: [reSIProcate] DUM shutdown message processing
> 
> Hi, all,
> 
> It seems that DUM doesnot handle ShutdownMessage
> posted by SipStack::shutdown():
> 
> void
> TransactionController::process(FdSet& fdset)
> {
>    if (mShuttingDown &&
>        //mTimers.empty() &&
>        !mStateMacFifo.messageAvailable() &&
>        !mTUFifo.messageAvailable() &&
>        mTransportSelector.isFinished())
>    {
>       mTUFifo.add(new ShutdownMessage);
>    }
> ...
> }
> 
> For application running sip stack in a separated
> thread by calling DialogUsageManager::process(true),
> this is essential to cleanly shutdown the DUM. The
> proposed way to do that looks like as following:
> 
> DialogUsageManager::process(bool separateThread)
> {
> ....
>   ShutdownMessage* shutdownMsg =
> dynamic_cast<ShutdownMessage*>(msg.get());
>   if (ShutdownMessage)
>   {
>       mShutdownHandler->onDumCanBeDeleted();
>   }
> ....
> }
> 
> Is that right? Any comments are welcome.
> 
> Regards,
> 
> kaiduan
> 
> 
> ______________________________________________________________________
> Post your free ad now! http://personals.yahoo.ca
> _______________________________________________
> resiprocate-devel mailing list
> resiprocate-devel@xxxxxxxxxxxxxxxxxxx
> https://list.sipfoundry.org/mailman/listinfo/resiprocate-devel
> _______________________________________________
> resiprocate-devel mailing list
> resiprocate-devel@xxxxxxxxxxxxxxxxxxx
> https://list.sipfoundry.org/mailman/listinfo/resiprocate-devel