/[resiprocate]/branches/b-identity-0505/InterruptableStackThread.cxx
ViewVC logotype

Contents of /branches/b-identity-0505/InterruptableStackThread.cxx

Parent Directory Parent Directory | Revision Log Revision Log


Revision 4598 - (show annotations) (download)
Wed May 11 22:53:07 2005 UTC (14 years, 6 months ago) by derek
File size: 4019 byte(s)
set svn:eol-style to LF
1 #include "resiprocate/InterruptableStackThread.hxx"
2 #include "resiprocate/SipStack.hxx"
3 #include "resiprocate/SipMessage.hxx"
4 #include "resiprocate/os/Logger.hxx"
5
6 #define RESIPROCATE_SUBSYSTEM Subsystem::SIP
7
8 using namespace resip;
9
10 InterruptableStackThread::InterruptableStackThread(SipStack& stack, SelectInterruptor& si)
11 : mStack(stack),
12 mSelectInterruptor(si)
13 {}
14
15 InterruptableStackThread::~InterruptableStackThread()
16 {
17 //InfoLog (<< "InterruptableStackThread::~InterruptableStackThread()");
18 }
19
20 void
21 InterruptableStackThread::thread()
22 {
23 while (!isShutdown())
24 {
25 try
26 {
27 FdSet fdset;
28 mStack.process(fdset); // .dcm. reqd to get send requests queued at transports
29 mSelectInterruptor.buildFdSet(fdset);
30 mStack.buildFdSet(fdset);
31 int ret = fdset.selectMilliSeconds(resipMin(mStack.getTimeTillNextProcessMS(),
32 getTimeTillNextProcessMS()));
33 if (ret >= 0)
34 {
35 // .dlb. use return value to peak at the message to see if it is a
36 // shutdown, and call shutdown if it is
37 // .dcm. how will this interact w/ TuSelector?
38 mSelectInterruptor.buildFdSet(fdset);
39 mStack.process(fdset);
40 }
41 }
42 catch (BaseException& e)
43 {
44 InfoLog (<< "Unhandled exception: " << e);
45 }
46 }
47 WarningLog (<< "Shutting down stack thread");
48 }
49
50 void
51 InterruptableStackThread::buildFdSet(FdSet& fdset)
52 {}
53
54 unsigned int
55 InterruptableStackThread::getTimeTillNextProcessMS() const
56 {
57 //.dcm. --- eventually make infinite
58 return 10000;
59 }
60
61 /* ====================================================================
62 * The Vovida Software License, Version 1.0
63 *
64 * Copyright (c) 2000 Vovida Networks, Inc. All rights reserved.
65 *
66 * Redistribution and use in source and binary forms, with or without
67 * modification, are permitted provided that the following conditions
68 * are met:
69 *
70 * 1. Redistributions of source code must retain the above copyright
71 * notice, this list of conditions and the following disclaimer.
72 *
73 * 2. Redistributions in binary form must reproduce the above copyright
74 * notice, this list of conditions and the following disclaimer in
75 * the documentation and/or other materials provided with the
76 * distribution.
77 *
78 * 3. The names "VOCAL", "Vovida Open Communication Application Library",
79 * and "Vovida Open Communication Application Library (VOCAL)" must
80 * not be used to endorse or promote products derived from this
81 * software without prior written permission. For written
82 * permission, please contact vocal@vovida.org.
83 *
84 * 4. Products derived from this software may not be called "VOCAL", nor
85 * may "VOCAL" appear in their name, without prior written
86 * permission of Vovida Networks, Inc.
87 *
88 * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED
89 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
90 * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND
91 * NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL VOVIDA
92 * NETWORKS, INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT DAMAGES
93 * IN EXCESS OF $1,000, NOR FOR ANY INDIRECT, INCIDENTAL, SPECIAL,
94 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
95 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
96 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
97 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
98 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
99 * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
100 * DAMAGE.
101 *
102 * ====================================================================
103 *
104 * This software consists of voluntary contributions made by Vovida
105 * Networks, Inc. and many individuals on behalf of Vovida Networks,
106 * Inc. For more information on Vovida Networks, Inc., please see
107 * <http://www.vovida.org/>.
108 *
109 */

Properties

Name Value
svn:eol-style LF

webmaster AT resiprocate DOT org
ViewVC Help
Powered by ViewVC 1.1.27