1
#include "resip/stack/InterruptableStackThread.hxx"
2
#include "resip/stack/SipStack.hxx"
3
#include "resip/stack/SipMessage.hxx"
4
#include "rutil/SelectInterruptor.hxx"
5
#include "rutil/Logger.hxx"
7
#define RESIPROCATE_SUBSYSTEM Subsystem::SIP
11
InterruptableStackThread::InterruptableStackThread(SipStack& stack, SelectInterruptor& si)
13
mSelectInterruptor(si)
16
InterruptableStackThread::~InterruptableStackThread()
18
//InfoLog (<< "InterruptableStackThread::~InterruptableStackThread()");
22
InterruptableStackThread::thread()
29
mStack.process(fdset); // .dcm. reqd to get send requests queued at transports
30
mSelectInterruptor.buildFdSet(fdset);
31
mStack.buildFdSet(fdset);
33
int ret = fdset.selectMilliSeconds(resipMin(mStack.getTimeTillNextProcessMS(),
34
getTimeTillNextProcessMS()));
37
// .dlb. use return value to peak at the message to see if it is a
38
// shutdown, and call shutdown if it is
39
// .dcm. how will this interact w/ TuSelector?
40
mSelectInterruptor.process(fdset);
41
mStack.process(fdset);
45
catch (BaseException& e)
47
ErrLog (<< "Unhandled exception: " << e);
50
InfoLog (<< "Shutting down stack thread");
54
InterruptableStackThread::shutdown()
57
mSelectInterruptor.interrupt();
61
InterruptableStackThread::buildFdSet(FdSet& fdset)
66
InterruptableStackThread::getTimeTillNextProcessMS() const
68
//.dcm. --- eventually make infinite
73
InterruptableStackThread::process(FdSet& fdset)
77
/* ====================================================================
78
* The Vovida Software License, Version 1.0
80
* Copyright (c) 2000 Vovida Networks, Inc. All rights reserved.
82
* Redistribution and use in source and binary forms, with or without
83
* modification, are permitted provided that the following conditions
86
* 1. Redistributions of source code must retain the above copyright
87
* notice, this list of conditions and the following disclaimer.
89
* 2. Redistributions in binary form must reproduce the above copyright
90
* notice, this list of conditions and the following disclaimer in
91
* the documentation and/or other materials provided with the
94
* 3. The names "VOCAL", "Vovida Open Communication Application Library",
95
* and "Vovida Open Communication Application Library (VOCAL)" must
96
* not be used to endorse or promote products derived from this
97
* software without prior written permission. For written
98
* permission, please contact vocal@vovida.org.
100
* 4. Products derived from this software may not be called "VOCAL", nor
101
* may "VOCAL" appear in their name, without prior written
102
* permission of Vovida Networks, Inc.
104
* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED
105
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
106
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND
107
* NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL VOVIDA
108
* NETWORKS, INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT DAMAGES
109
* IN EXCESS OF $1,000, NOR FOR ANY INDIRECT, INCIDENTAL, SPECIAL,
110
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
111
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
112
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
113
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
114
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
115
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
118
* ====================================================================
120
* This software consists of voluntary contributions made by Vovida
121
* Networks, Inc. and many individuals on behalf of Vovida Networks,
122
* Inc. For more information on Vovida Networks, Inc., please see
123
* <http://www.vovida.org/>.