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

Re: [reSIProcate] Correct way to shutdown dum


Matthias Moetje - TERASENS GmbH wrote:

Hi,

when I shutdown dum I would like to shutdown as gracefully
as possible. Also I want to remove all registrations and
have all active sessions closed. I am looking for the best
method to acomplish that. In addition I don't have much
time for it (max. 5s) because my application must be shut down through a synchronous function (called from another
application).
The shutdown method of dum has a "giveUpSeconds" parameter
but this paramter is just ignored/unused. So how should
I shutdown everything?

Currently I'm doing this:


if (mStackThread) {
                        mStackThread->shutdown();
                }
if (mDumThread) {
                        mDumThread->shutdown();
                }
if (mStackThread) {
                        mStackThread->join();
                        delete mStackThread;
                        mStackThread = NULL;
                }
if (mDumThread) {
                        mDumThread->join();
                        delete mDumThread;
                        mDumThread = NULL;
                }
if (mDum) {
                        delete mDum;
                        mDum = NULL;
                }

if (mStack) {
                        delete mStack;
                        mStack = NULL;
                }

But obviously this doesn't wait until all sessions are
ended or registrations have been removed..

Is there an accepted order for shutting down these "services"?
I know they have a "Shutdown handler",  but there are no examples
on how to use it....   Shouldn't that eventually be written into the
WIKI?

It was much much easier for me to deploy a "state" variable
to tell me what State the stack is in,  so I can deploy the proper
shutdown code.  Seems to work for me,  and I intend to do it this
way until an easier way is found.

John