(file) Return to CIMListener.cpp CVS log (file) (dir) Up to [Pegasus] / pegasus / src / Pegasus / Listener

  1 karl  1.40 //%2006////////////////////////////////////////////////////////////////////////
  2 kumpf 1.1  //
  3 karl  1.25 // Copyright (c) 2000, 2001, 2002 BMC Software; Hewlett-Packard Development
  4            // Company, L.P.; IBM Corp.; The Open Group; Tivoli Systems.
  5            // Copyright (c) 2003 BMC Software; Hewlett-Packard Development Company, L.P.;
  6 karl  1.12 // IBM Corp.; EMC Corporation, The Open Group.
  7 karl  1.25 // Copyright (c) 2004 BMC Software; Hewlett-Packard Development Company, L.P.;
  8            // IBM Corp.; EMC Corporation; VERITAS Software Corporation; The Open Group.
  9 karl  1.28 // Copyright (c) 2005 Hewlett-Packard Development Company, L.P.; IBM Corp.;
 10            // EMC Corporation; VERITAS Software Corporation; The Open Group.
 11 karl  1.40 // Copyright (c) 2006 Hewlett-Packard Development Company, L.P.; IBM Corp.;
 12            // EMC Corporation; Symantec Corporation; The Open Group.
 13 kumpf 1.1  //
 14            // Permission is hereby granted, free of charge, to any person obtaining a copy
 15            // of this software and associated documentation files (the "Software"), to
 16            // deal in the Software without restriction, including without limitation the
 17            // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
 18            // sell copies of the Software, and to permit persons to whom the Software is
 19            // furnished to do so, subject to the following conditions:
 20 karl  1.40 // 
 21 kumpf 1.1  // THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN
 22            // ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED
 23            // "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
 24            // LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
 25            // PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
 26            // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
 27            // ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
 28            // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 29            //
 30            //==============================================================================
 31            //
 32 tony  1.8  // Author: Dong Xiang, EMC Corporation (xiang_dong@emc.com)
 33 kumpf 1.1  //
 34 dj.gorey 1.14 // Modified By:   Dan Gorey (djgorey@us.ibm.com)
 35 a.arora  1.21 //                Amit K Arora, IBM (amita@in.ibm.com) for PEP#183
 36 kumpf    1.26 //                Roger Kumpf, Hewlett-Packard Company (roger_kumpf@hp.com)
 37 david.dillard 1.31 //                David Dillard, VERITAS Software Corp.
 38                    //                    (david.dillard@veritas.com)
 39 vijay.eli     1.33 //                Vijay Eli, IBM (vijay.eli@in.ibm.com) for bug#3425
 40 aruran.ms     1.35 //                Aruran, IBM (ashanmug@in.ibm.com) for Bug# 3604
 41 kumpf         1.1  //
 42                    //%/////////////////////////////////////////////////////////////////////////////
 43                    
 44 tony          1.8  #include "CIMListener.h"
 45 kumpf         1.1  
 46 tony          1.8  #include <Pegasus/Common/Exception.h>
 47                    #include <Pegasus/Common/SSLContext.h>
 48                    #include <Pegasus/Common/Monitor.h>
 49 kumpf         1.1  #include <Pegasus/Common/HTTPAcceptor.h>
 50 kumpf         1.11 #include <Pegasus/Common/PegasusVersion.h>
 51 konrad.r      1.38 #include <Pegasus/Common/MessageLoader.h>
 52 kumpf         1.2  
 53 kumpf         1.1  #include <Pegasus/ExportServer/CIMExportResponseEncoder.h>
 54                    #include <Pegasus/ExportServer/CIMExportRequestDecoder.h>
 55                    
 56 tony          1.8  #include <Pegasus/Consumer/CIMIndicationConsumer.h>
 57                    #include <Pegasus/Listener/CIMListenerIndicationDispatcher.h>
 58                    
 59                    PEGASUS_NAMESPACE_BEGIN
 60                    /////////////////////////////////////////////////////////////////////////////
 61                    // CIMListenerService
 62                    /////////////////////////////////////////////////////////////////////////////
 63                    class CIMListenerService
 64                    {
 65                    public:
 66                    	CIMListenerService(Uint32 portNumber, SSLContext* sslContext=NULL);
 67                    	CIMListenerService(CIMListenerService& svc);
 68                      ~CIMListenerService();
 69                    
 70                    	void				init();
 71                    	/** bind to the port
 72                    	*/
 73                    	void				bind();
 74                    	/** runForever Main runloop for the server.
 75                    	*/
 76                    	void runForever();
 77 david.dillard 1.31 
 78 tony          1.8  	/** Call to gracefully shutdown the server.  The server connection socket
 79                    	will be closed to disable new connections from clients.
 80                    	*/
 81                    	void stopClientConnection();
 82 david.dillard 1.31 
 83 tony          1.8  	/** Call to gracefully shutdown the server.  It is called when the server
 84                    	has been stopped and is ready to be shutdown.  Next time runForever()
 85                    	is called, the server shuts down.
 86                    	*/
 87                    	void shutdown();
 88 david.dillard 1.31 
 89 tony          1.8  	/** Return true if the server has shutdown, false otherwise.
 90                    	*/
 91 david.dillard 1.34 	Boolean terminated() const { return _dieNow; };
 92 david.dillard 1.31 
 93 tony          1.8  	/** Call to resume the sever.
 94                    	*/
 95                    	void resume();
 96 david.dillard 1.31 
 97 tony          1.8  	/** Call to set the CIMServer state.  Also inform the appropriate
 98                    	message queues about the current state of the CIMServer.
 99                    	*/
100                    	void setState(Uint32 state);
101 david.dillard 1.31 
102 tony          1.8  	Uint32 getOutstandingRequestCount();
103                    
104                    	/** Returns the indication listener dispatcher
105                    	 */
106                    	CIMListenerIndicationDispatcher* getIndicationDispatcher() const;
107                    
108 david.dillard 1.34 	/** Returns the indication listener dispatcher
109 tony          1.8  	 */
110                    	void setIndicationDispatcher(CIMListenerIndicationDispatcher* dispatcher);
111                    
112 david.dillard 1.34 	/** Returns the port number being used.
113                    	 */
114                    	Uint32 getPortNumber() const;
115                    
116 tony          1.8  	static PEGASUS_THREAD_RETURN PEGASUS_THREAD_CDECL _listener_routine(void *param);
117                    
118                    private:
119 david.dillard 1.34 	Uint32 _portNumber;
120 tony          1.8  	SSLContext* _sslContext;
121 david.dillard 1.34 	Monitor* _monitor;
122 mike          1.40.12.1 	Mutex _monitorMutex;
123 david.dillard 1.34      	HTTPAcceptor* _acceptor;
124 dj.gorey      1.14      
125                           Boolean					_dieNow;
126 tony          1.8       
127                           CIMListenerIndicationDispatcher* _dispatcher;
128                         
129                           CIMExportResponseEncoder* _responseEncoder;
130                           CIMExportRequestDecoder*  _requestDecoder;
131                         
132                         };
133                         
134                         CIMListenerService::CIMListenerService(Uint32 portNumber, SSLContext* sslContext)
135                         :_portNumber(portNumber)
136                         ,_sslContext(sslContext)
137                         ,_monitor(NULL)
138                         ,_acceptor(NULL)
139                         ,_dieNow(false)
140                         ,_dispatcher(NULL)
141                         ,_responseEncoder(NULL)
142                         ,_requestDecoder(NULL)
143                         {
144                         }
145                         
146                         CIMListenerService::CIMListenerService(CIMListenerService& svc)
147 tony          1.8       :_portNumber(svc._portNumber)
148                         ,_sslContext(svc._sslContext)
149                         ,_monitor(NULL)
150                         ,_acceptor(NULL)
151                         ,_dieNow(svc._dieNow)
152                         ,_dispatcher(NULL)
153                         ,_responseEncoder(NULL)
154                         ,_requestDecoder(NULL)
155                         {
156                         }
157                         CIMListenerService::~CIMListenerService()
158                         {
159 kumpf         1.36          // if port is alive, clean up the port
160                             //delete _sslContext;
161 tony          1.8       
162 kumpf         1.36          delete _responseEncoder;
163 tony          1.8       
164 kumpf         1.36          delete _requestDecoder;
165 kumpf         1.1       
166 kumpf         1.36          //delete _dispatcher;
167 kumpf         1.1       
168 kumpf         1.36          delete _acceptor;
169 kumpf         1.1       
170 kumpf         1.36          delete _monitor;
171 tony          1.8       }
172 kumpf         1.1       
173 tony          1.8       void CIMListenerService::init()
174 kumpf         1.1       {
175 tony          1.8       	PEG_METHOD_ENTER(TRC_LISTENER, "CIMListenerService::init");
176 kumpf         1.1       
177 vijay.eli     1.33        if(NULL == _monitor) _monitor = new Monitor();
178 david.dillard 1.31      
179 tony          1.8       	//_dispatcher = new CIMListenerIndicationDispatcher();
180 kumpf         1.1       
181 vijay.eli     1.33        if(NULL == _responseEncoder) _responseEncoder = new CIMExportResponseEncoder();
182                           if(NULL == _requestDecoder) _requestDecoder = new CIMExportRequestDecoder(
183                                                               _dispatcher,_responseEncoder->getQueueId());
184 tony          1.8       
185 vijay.eli     1.33        if(NULL == _acceptor) _acceptor = new HTTPAcceptor(
186 david.dillard 1.31      		 _monitor,
187                         		 _requestDecoder,
188                         		 false,
189                         		 _portNumber,
190 kumpf         1.19      		 _sslContext,
191                                          false);
192 kumpf         1.1       
193 chuck         1.20        bind();
194 kumpf         1.1       
195 chuck         1.20        PEG_METHOD_EXIT();
196 tony          1.8       }
197 david.dillard 1.34      
198 tony          1.8       void CIMListenerService::bind()
199                         {
200 chuck         1.20        if(_acceptor!=NULL)
201                             { // Bind to the port
202                               _acceptor->bind();
203 tony          1.8       
204 chuck         1.20            //listener.addAcceptor(false, portNumberHttp, false);
205                               Logger::put(Logger::STANDARD_LOG, System::CIMLISTENER, Logger::INFORMATION,
206 tony          1.8                               "Listening on HTTP port $0.", _portNumber);
207 kumpf         1.1       
208 chuck         1.20          }
209 tony          1.8       }
210 chuck         1.20      
211 tony          1.8       void CIMListenerService::runForever()
212                         {
213 chuck         1.20        static int modulator = 0;
214 kumpf         1.1       
215 chuck         1.20        if(!_dieNow)
216 dj.gorey      1.14          {
217 david.dillard 1.31            if(false == _monitor->run(500000))
218                         	{
219 chuck         1.20      	  modulator++;
220 david.dillard 1.31            try
221 a.arora       1.21            {
222                         	     //MessageQueueService::_check_idle_flag = 1;
223                         		 //MessageQueueService::_polling_sem.signal();
224 kumpf         1.30      		 MessageQueueService::get_thread_pool()->cleanupIdleThreads();
225 a.arora       1.21            }
226                         	  catch(...)
227                               {
228                               }
229 chuck         1.20      	}
230                         /*
231                               if (handleShutdownSignal)
232                               {
233                                 Tracer::trace(TRC_SERVER, Tracer::LEVEL3,
234                         	"CIMServer::runForever - signal received.  Shutting down.");
235                         
236                         	ShutdownService::getInstance(this)->shutdown(true, 10, false);
237                         	handleShutdownSignal = false;
238                               }
239 tony          1.8       */
240 chuck         1.20          }
241 tony          1.8       }
242 kumpf         1.1       
243 tony          1.8       void CIMListenerService::shutdown()
244                         {
245                             PEG_METHOD_ENTER(TRC_LISTENER, "CIMListenerService::shutdown()");
246 kumpf         1.1       
247 mike          1.40.12.1     // This logic signals the thread currently executing _listener_routine()
248                             // to exit. That function deletes this instance of CIMListenerService, 
249                             // which deletes the _monitor member. We use a mutex to keep it from 
250                             // deleting the monitor until after tickle has been called.
251                             {
252                         	AutoMutex am(_monitorMutex);
253                         	_dieNow = true;
254                         	_monitor->tickle();
255                             }
256 kumpf         1.1       
257 kumpf         1.4           PEG_METHOD_EXIT();
258 kumpf         1.1       }
259                         
260 tony          1.8       void CIMListenerService::resume()
261 kumpf         1.1       {
262 tony          1.8           PEG_METHOD_ENTER(TRC_LISTENER, "CIMListenerService::resume()");
263 kumpf         1.1       
264 tony          1.8           if(_acceptor!=NULL)
265                                 _acceptor->reopenConnectionSocket();
266 kumpf         1.1       
267 kumpf         1.4           PEG_METHOD_EXIT();
268 kumpf         1.1       }
269                         
270 tony          1.8       void CIMListenerService::stopClientConnection()
271 kumpf         1.1       {
272 tony          1.8           PEG_METHOD_ENTER(TRC_LISTENER, "CIMListenerService::stopClientConnection()");
273 kumpf         1.1       
274 kumpf         1.10          // tell Monitor to stop listening for client connections
275 chuck         1.22          _monitor->stopListeningForConnections(true);
276 kumpf         1.10      
277                             //
278                             // Wait 150 milliseconds to allow time for the Monitor to stop
279                             // listening for client connections.
280                             //
281                             // This wait time is the timeout value for the select() call
282                             // in the Monitor's run() method (currently set to 100
283                             // milliseconds) plus a delta of 50 milliseconds.  The reason
284                             // for the wait here is to make sure that the Monitor entries
285                             // are updated before closing the connection sockets.
286                             //
287 a.arora       1.21          // pegasus_sleep(150); Not needed now due to the semaphore in the Monitor
288 david.dillard 1.31      
289 tony          1.8           if(_acceptor!=NULL)
290                             _acceptor->closeConnectionSocket();
291 kumpf         1.1       
292 kumpf         1.4           PEG_METHOD_EXIT();
293 kumpf         1.1       }
294                         
295 chuck         1.23      Uint32 CIMListenerService::getOutstandingRequestCount()
296                         {
297                             return _acceptor->getOutstandingRequestCount();
298                         }
299 tony          1.8       
300                         CIMListenerIndicationDispatcher* CIMListenerService::getIndicationDispatcher() const
301 kumpf         1.1       {
302 david.dillard 1.32          return _dispatcher;
303 tony          1.8       }
304 david.dillard 1.34      
305 tony          1.8       void CIMListenerService::setIndicationDispatcher(CIMListenerIndicationDispatcher* dispatcher)
306                         {
307 david.dillard 1.32          _dispatcher = dispatcher;
308 kumpf         1.1       }
309                         
310 david.dillard 1.34      Uint32 CIMListenerService::getPortNumber() const
311                         {
312                         
313                             Uint32 portNumber = _portNumber;
314                         
315                             if (( portNumber == 0 ) && ( _acceptor != 0 ))
316                             {
317                                 portNumber = _acceptor->getPortNumber();
318                             }
319                         
320                             return(portNumber);
321                         }
322                         
323 tony          1.8       PEGASUS_THREAD_RETURN PEGASUS_THREAD_CDECL CIMListenerService::_listener_routine(void *param)
324 kumpf         1.1       {
325 mike          1.40.12.1     CIMListenerService* svc = reinterpret_cast<CIMListenerService*>(param);
326                         
327 konrad.r      1.37        try { 
328 kumpf         1.1       
329 david.dillard 1.32          //svc->init(); bug 1394
330                             while(!svc->terminated())
331                             {
332 chuck         1.20      #if defined(PEGASUS_PLATFORM_DARWIN_PPC_GNU)
333 david.dillard 1.32              pthread_testcancel();
334 chuck         1.20      #endif
335 david.dillard 1.32              svc->runForever();
336                             }
337 konrad.r      1.37        } catch (...) 
338                           { 
339                                 Tracer::trace(TRC_SERVER, Tracer::LEVEL2,
340                         			"Unknown exception thrown in _listener_routine.");
341                           }
342 mike          1.40.12.1 
343                           // CAUTION: deleting the service also deletes the monitor whose tickle()
344                           // method may still be executing in another thread. This line of code was
345                           // most likely reached when the CIMListenerService::shutdown() method set
346                           // _dieNow to true and called Monitor::tickle(). We must wait until we can
347                           // obtain the _monitorMutex, indicating that we are no longer inside
348                           // Monitor::ticle().
349                         
350                           svc->_monitorMutex.lock();
351                           svc->_monitorMutex.unlock();
352                           delete svc;
353                         
354 david.dillard 1.32          return 0;
355 tony          1.8       }
356                         
357                         /////////////////////////////////////////////////////////////////////////////
358                         // CIMListenerRep
359                         /////////////////////////////////////////////////////////////////////////////
360                         class CIMListenerRep
361                         {
362                         public:
363                         	CIMListenerRep(Uint32 portNumber, SSLContext* sslContext=NULL);
364                           ~CIMListenerRep();
365                         
366                         	Uint32 getPortNumber() const;
367                         
368                         	SSLContext* getSSLContext() const;
369                         	void setSSLContext(SSLContext* sslContext);
370 david.dillard 1.31      
371 tony          1.8       	void start();
372                         	void stop();
373                         
374                         	Boolean isAlive();
375                         
376                         	Boolean addConsumer(CIMIndicationConsumer* consumer);
377                         	Boolean removeConsumer(CIMIndicationConsumer* consumer);
378                         
379                         private:
380 chuck         1.23        Boolean waitForPendingRequests(Uint32 shutdownTimeout);
381                         
382                           Uint32 _portNumber;
383                           SSLContext* _sslContext;
384 tony          1.8       
385                           CIMListenerIndicationDispatcher* _dispatcher;
386 chuck         1.23        ThreadPool* _thread_pool;
387 david.dillard 1.31        CIMListenerService* _svc;
388 chuck         1.20        Semaphore *_listener_sem;
389 tony          1.8       };
390                         
391                         CIMListenerRep::CIMListenerRep(Uint32 portNumber, SSLContext* sslContext)
392                         :_portNumber(portNumber)
393                         ,_sslContext(sslContext)
394                         ,_dispatcher(new CIMListenerIndicationDispatcher())
395                         ,_thread_pool(NULL)
396 chuck         1.20      ,_svc(NULL)
397                         ,_listener_sem(NULL)
398 tony          1.8       {
399                         }
400 david.dillard 1.31      
401 tony          1.8       CIMListenerRep::~CIMListenerRep()
402                         {
403 david.dillard 1.31          // if port is alive, clean up the port
404                             if (_thread_pool != 0)
405                             {
406                                 // Block incoming export requests and unbind the port
407                                 _svc->stopClientConnection();
408                         
409                                 // Wait until pending export requests in the server are done.
410                                 waitForPendingRequests(10);
411 chuck         1.23      
412 david.dillard 1.31              // Shutdown the CIMListenerService
413                                 _svc->shutdown();
414                             }
415 chuck         1.20      
416                             delete _sslContext;
417                             delete _dispatcher;
418                             delete _thread_pool;
419                             delete _listener_sem;
420 tony          1.8       
421 chuck         1.20        // don't delete _svc, this is deleted by _listener_routine
422 tony          1.8       }
423                         
424                         Uint32 CIMListenerRep::getPortNumber() const
425                         {
426 david.dillard 1.34          Uint32 portNumber;
427                         
428                             if ( _svc == 0 )
429                             {
430                                 portNumber = _portNumber;
431                             }
432                             else portNumber = _svc->getPortNumber();
433                         
434                             return portNumber;
435 tony          1.8       }
436 kumpf         1.1       
437 tony          1.8       SSLContext* CIMListenerRep::getSSLContext() const
438                         {
439 david.dillard 1.31          return _sslContext;
440 kumpf         1.1       }
441 david.dillard 1.31      
442 tony          1.8       void CIMListenerRep::setSSLContext(SSLContext* sslContext)
443                         {
444 david.dillard 1.31          delete _sslContext;
445                             _sslContext = sslContext;
446                         }
447 kumpf         1.1       
448 tony          1.8       void CIMListenerRep::start()
449 kumpf         1.1       {
450 david.dillard 1.31          // spawn a thread to do this
451                             if(_thread_pool==0)
452 chuck         1.20          {
453 david.dillard 1.31              AutoPtr<CIMListenerService> svc(new CIMListenerService(_portNumber,_sslContext));
454 chuck         1.20      
455 david.dillard 1.31              svc->setIndicationDispatcher(_dispatcher);
456                                 svc->init();
457 chuck         1.20      
458 david.dillard 1.31              struct timeval deallocateWait = {15, 0};
459                                 AutoPtr<ThreadPool> threadPool(new ThreadPool(0, "Listener", 0, 1, deallocateWait));
460                                 AutoPtr<Semaphore> sem(new Semaphore(0));
461 konrad.r      1.38              if (threadPool->allocate_and_awaken(svc.get(), CIMListenerService::_listener_routine, sem.get()) != PEGASUS_THREAD_OK)
462                             	{
463                         	    Logger::put(Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE,
464                         			"Not enough threads to start CIMListernerService.");
465                          
466                         	    Tracer::trace(TRC_SERVER, Tracer::LEVEL2,
467                         			"Could not allocate thread for CIMListenerService::_listener_routine."); 
468                         	    throw Exception(MessageLoaderParms("Listener.CIMListener.CANNOT_ALLOCATE_THREAD",
469                         				"Could not allocate thread."));
470                                 }
471 david.dillard 1.31              Logger::put(Logger::STANDARD_LOG,System::CIMLISTENER, Logger::INFORMATION,
472                                                 "CIMListener started");
473                         
474                                 _svc = svc.release();
475                                 _thread_pool = threadPool.release();
476                                 _listener_sem = sem.release();
477                             }
478 tony          1.8       }
479 kumpf         1.1       
480 tony          1.8       void CIMListenerRep::stop()
481                         {
482 chuck         1.20        if(_thread_pool!=NULL)
483 david.dillard 1.31        {
484 chuck         1.20          //
485                             // Graceful shutdown of the listener service
486                             //
487                         
488                             // Block incoming export requests and unbind the port
489                             _svc->stopClientConnection();
490 chuck         1.23      
491                             // Wait until pending export requests in the server are done.
492 chuck         1.24          waitForPendingRequests(10);
493 david.dillard 1.31      
494 chuck         1.20          // Shutdown the CIMListenerService
495                             _svc->shutdown();
496                         
497                             // Wait for the _listener_routine thread to exit.
498                             // The thread could be delivering an export, so give it 3sec.
499                             // Note that _listener_routine deletes the CIMListenerService,
500                             // so no need to delete _svc.
501                             try
502                             {
503 david.dillard 1.31            _listener_sem->time_wait(3000);
504 chuck         1.20          }
505 david.dillard 1.34          catch (const TimeOut &)
506 chuck         1.20          {
507                               // No need to do anything, the thread pool will be deleted below
508                               // to cancel the _listener_routine thread if it is still running.
509                             }
510                         
511                             delete _listener_sem;
512                             _listener_sem = NULL;
513 david.dillard 1.31      
514 chuck         1.20          // Delete the thread pool.  This cancels the listener thread if it is still
515                             // running.
516                             delete _thread_pool;
517                             _thread_pool = NULL;
518                         
519                             Logger::put(Logger::STANDARD_LOG,System::CIMLISTENER,
520                         		Logger::INFORMATION,
521                         		"CIMListener stopped");
522                           }
523 kumpf         1.1       }
524                         
525 tony          1.8       Boolean CIMListenerRep::isAlive()
526 kumpf         1.1       {
527 tony          1.8       	return (_thread_pool!=NULL)?true:false;
528                         }
529 kumpf         1.1       
530 tony          1.8       Boolean CIMListenerRep::addConsumer(CIMIndicationConsumer* consumer)
531                         {
532                         	return _dispatcher->addConsumer(consumer);
533                         }
534                         Boolean CIMListenerRep::removeConsumer(CIMIndicationConsumer* consumer)
535                         {
536                         	return _dispatcher->removeConsumer(consumer);
537                         }
538 kumpf         1.1       
539 chuck         1.23      Boolean CIMListenerRep::waitForPendingRequests(Uint32 shutdownTimeout)
540                         {
541                           // Wait for 10 sec max
542                           Uint32 reqCount;
543                           Uint32 countDown = shutdownTimeout * 10;
544                           for (; countDown > 0; countDown--)
545                           {
546                             reqCount = _svc->getOutstandingRequestCount();
547                             if (reqCount > 0)
548                               pegasus_sleep(100);
549                             else
550                               return true;
551                           }
552 david.dillard 1.31      
553 chuck         1.23        return false;
554 david.dillard 1.31      }
555 chuck         1.23      
556 tony          1.8       /////////////////////////////////////////////////////////////////////////////
557                         // CIMListener
558                         /////////////////////////////////////////////////////////////////////////////
559                         CIMListener::CIMListener(Uint32 portNumber, SSLContext* sslContext)
560                         :_rep(new CIMListenerRep(portNumber,sslContext))
561                         {
562                         }
563                         CIMListener::~CIMListener()
564                         {
565                         	if(_rep!=NULL)
566 tony          1.9       		delete static_cast<CIMListenerRep*>(_rep);
567 tony          1.8       	_rep=NULL;
568                         }
569 david.dillard 1.31      
570 tony          1.8       Uint32 CIMListener::getPortNumber() const
571                         {
572                         	return static_cast<CIMListenerRep*>(_rep)->getPortNumber();
573 kumpf         1.1       }
574                         
575 tony          1.8       SSLContext* CIMListener::getSSLContext() const
576                         {
577                         	return static_cast<CIMListenerRep*>(_rep)->getSSLContext();
578                         }
579                         void CIMListener::setSSLContext(SSLContext* sslContext)
580                         {
581                         	static_cast<CIMListenerRep*>(_rep)->setSSLContext(sslContext);
582                         }
583                         void CIMListener::start()
584 kumpf         1.1       {
585 tony          1.8       	static_cast<CIMListenerRep*>(_rep)->start();
586                         }
587                         void CIMListener::stop()
588                         {
589                         	static_cast<CIMListenerRep*>(_rep)->stop();
590                         }
591 kumpf         1.1       
592 aruran.ms     1.35      Boolean CIMListener::isAlive() const
593 tony          1.8       {
594                         	return static_cast<CIMListenerRep*>(_rep)->isAlive();
595                         }
596 kumpf         1.1       
597 tony          1.8       Boolean CIMListener::addConsumer(CIMIndicationConsumer* consumer)
598                         {
599                         	return static_cast<CIMListenerRep*>(_rep)->addConsumer(consumer);
600                         }
601                         Boolean CIMListener::removeConsumer(CIMIndicationConsumer* consumer)
602                         {
603                         	return static_cast<CIMListenerRep*>(_rep)->removeConsumer(consumer);
604 kumpf         1.1       }
605                         
606                         PEGASUS_NAMESPACE_END

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2