/[resiprocate]/main/resip/dum/DumProcessHandler.cxx
ViewVC logotype

Contents of /main/resip/dum/DumProcessHandler.cxx

Parent Directory Parent Directory | Revision Log Revision Log


Revision 5948 - (show annotations) (download)
Fri Feb 17 15:30:16 2006 UTC (13 years, 9 months ago) by dworley
File MIME type: text/plain
File size: 4467 byte(s)
Setting more svn: properties, and adding EOLs to the ends of files
that need it.

1 #include "resip/stack/SipStack.hxx"
2 #include "resip/dum/DialogUsageManager.hxx"
3 #include "resip/dum/DumProcessHandler.hxx"
4 #include "rutil/Logger.hxx"
5
6 #define RESIPROCATE_SUBSYSTEM Subsystem::DUM
7
8 namespace resip {
9
10 DumProcessHandler::DumProcessHandler(ExternalTimer* et) :
11 mHaveActiveTimer(false),
12 mDum(0),
13 mExternalTimer(et),
14 mStopped(false),
15 mCurrentlyProcessing(false)
16 {
17 }
18
19 void
20 DumProcessHandler::start(DialogUsageManager* dum)
21 {
22 mDum = dum;
23 mExternalTimer->setHandler(this);
24 mTimerID = mExternalTimer->generateAsyncID();
25 }
26
27 void
28 DumProcessHandler::handleProcessNotification()
29 {
30 #if 0 // !dcm! this needs to be fixed in the new model
31 //only works when there is exactly one thread causing notifications; could be
32 //made thread safecancelled
33 if (!mCurrentlyProcessing && !mStopped)
34 {
35 mCurrentlyProcessing = true;
36 //very temporary
37 //FD_ISSET ??
38 FdSet fds;
39 mDum->buildFdSet(fds);
40 if (fds.size > 0)
41 {
42 fds.selectMilliSeconds((long)0);
43 }
44
45 int timeTillProcess = 0;
46 do
47 {
48 mDum->process(fds);
49 timeTillProcess = mDum->getTimeTillNextProcessMS();
50 }
51 while (timeTillProcess == 0);
52 if (timeTillProcess != INT_MAX)
53 {
54 if (mHaveActiveTimer)
55 {
56 mExternalTimer->deleteTimer(mTimerID);
57 }
58 assert(timeTillProcess < 60*4*60*1000); //4hr sanity check
59 mTimerID = mExternalTimer->generateAsyncID();
60 DebugLog ( << "Setting dum process timer: " << timeTillProcess);
61 mExternalTimer->createTimer(mTimerID, timeTillProcess);
62 mHaveActiveTimer = true;
63 }
64 mCurrentlyProcessing = false;
65 }
66 #endif
67 }
68
69 void
70 DumProcessHandler::handleTimeout(AsyncID timerID)
71 {
72 assert(timerID == mTimerID);
73 mHaveActiveTimer = false;
74 handleProcessNotification();
75 }
76
77
78 void
79 DumProcessHandler::stop()
80 {
81 mStopped = true;
82 if (mHaveActiveTimer)
83 {
84 mExternalTimer->deleteTimer(mTimerID);
85 }
86 }
87
88 } // namespace resip
89
90 /* ====================================================================
91 * The Vovida Software License, Version 1.0
92 *
93 * Copyright (c) 2000 Vovida Networks, Inc. All rights reserved.
94 *
95 * Redistribution and use in source and binary forms, with or without
96 * modification, are permitted provided that the following conditions
97 * are met:
98 *
99 * 1. Redistributions of source code must retain the above copyright
100 * notice, this list of conditions and the following disclaimer.
101 *
102 * 2. Redistributions in binary form must reproduce the above copyright
103 * notice, this list of conditions and the following disclaimer in
104 * the documentation and/or other materials provided with the
105 * distribution.
106 *
107 * 3. The names "VOCAL", "Vovida Open Communication Application Library",
108 * and "Vovida Open Communication Application Library (VOCAL)" must
109 * not be used to endorse or promote products derived from this
110 * software without prior written permission. For written
111 * permission, please contact vocal@vovida.org.
112 *
113 * 4. Products derived from this software may not be called "VOCAL", nor
114 * may "VOCAL" appear in their name, without prior written
115 * permission of Vovida Networks, Inc.
116 *
117 * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED
118 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
119 * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND
120 * NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL VOVIDA
121 * NETWORKS, INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT DAMAGES
122 * IN EXCESS OF $1,000, NOR FOR ANY INDIRECT, INCIDENTAL, SPECIAL,
123 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
124 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
125 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
126 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
127 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
128 * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
129 * DAMAGE.
130 *
131 * ====================================================================
132 *
133 * This software consists of voluntary contributions made by Vovida
134 * Networks, Inc. and many individuals on behalf of Vovida Networks,
135 * Inc. For more information on Vovida Networks, Inc., please see
136 * <http://www.vovida.org/>.
137 *
138 */

Properties

Name Value
svn:eol-style native
svn:mime-type text/plain

webmaster AT resiprocate DOT org
ViewVC Help
Powered by ViewVC 1.1.27