RE: [reSIProcate] DUM shutdown message processing
Scott,
Please see inline comments.
--- Scott Godin <slgodin@xxxxxxxxxxxx> wrote:
> 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).
If we wait DialogSets to end by itself, when DUM will
be shutdown? The time when DUM is really shutdown is
not defined.
Another problem, if application allocates an
ApplDialogSet on heap, and forgets to delete it, the
DUM::shutdown() will never be called. In this way, the
application will hangup there.
void DialogUsageManager::shutdown(DumShutdownHandler*
h)
{
mDumShutdownHandler = h;
shutdownWhenEmpty();
}
void HandleManager::shutdownWhenEmpty()
{
mShuttingDown = true;
if (mHandleMap.empty())
{
shutdown();
}
}
> 3. Continue calling process on DUM until
> onDumCanBeDeleted callback is
> called. This allows all DUM objects to clean
> themselves up.
Actually we can delete DUM object if we shutdown the
SIP stack first by calling DUM's destructor.
> 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
>
______________________________________________________________________
Post your free ad now! http://personals.yahoo.ca