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