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

Diff for /pegasus/src/Pegasus/Common/Monitor.cpp between version 1.130 and 1.137

version 1.130, 2008/02/27 20:21:17 version 1.137, 2008/12/01 17:49:53
Line 1 
Line 1 
 //%2006////////////////////////////////////////////////////////////////////////  //%LICENSE////////////////////////////////////////////////////////////////
 // //
 // Copyright (c) 2000, 2001, 2002 BMC Software; Hewlett-Packard Development  // Licensed to The Open Group (TOG) under one or more contributor license
 // Company, L.P.; IBM Corp.; The Open Group; Tivoli Systems.  // agreements.  Refer to the OpenPegasusNOTICE.txt file distributed with
 // Copyright (c) 2003 BMC Software; Hewlett-Packard Development Company, L.P.;  // this work for additional information regarding copyright ownership.
 // IBM Corp.; EMC Corporation, The Open Group.  // Each contributor licenses this file to you under the OpenPegasus Open
 // Copyright (c) 2004 BMC Software; Hewlett-Packard Development Company, L.P.;  // Source License; you may not use this file except in compliance with the
 // IBM Corp.; EMC Corporation; VERITAS Software Corporation; The Open Group.  // License.
 // Copyright (c) 2005 Hewlett-Packard Development Company, L.P.; IBM Corp.;  //
 // EMC Corporation; VERITAS Software Corporation; The Open Group.  // Permission is hereby granted, free of charge, to any person obtaining a
 // Copyright (c) 2006 Hewlett-Packard Development Company, L.P.; IBM Corp.;  // copy of this software and associated documentation files (the "Software"),
 // EMC Corporation; Symantec Corporation; The Open Group.  // to deal in the Software without restriction, including without limitation
 //  // the rights to use, copy, modify, merge, publish, distribute, sublicense,
 // Permission is hereby granted, free of charge, to any person obtaining a copy  // and/or sell copies of the Software, and to permit persons to whom the
 // of this software and associated documentation files (the "Software"), to  // Software is furnished to do so, subject to the following conditions:
 // deal in the Software without restriction, including without limitation the  //
 // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or  // The above copyright notice and this permission notice shall be included
 // sell copies of the Software, and to permit persons to whom the Software is  // in all copies or substantial portions of the Software.
 // furnished to do so, subject to the following conditions:  //
 //  // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
 // THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN  // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
 // ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED  // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
 // "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT  // IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
 // LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR  // CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
 // PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT  // TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
 // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN  // SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 // ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION  
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.  
 // //
 //==============================================================================  //////////////////////////////////////////////////////////////////////////
 // //
 //%///////////////////////////////////////////////////////////////////////////// //%/////////////////////////////////////////////////////////////////////////////
  
Line 39 
Line 37 
 #include "Socket.h" #include "Socket.h"
 #include <Pegasus/Common/Tracer.h> #include <Pegasus/Common/Tracer.h>
 #include <Pegasus/Common/HTTPConnection.h> #include <Pegasus/Common/HTTPConnection.h>
   #include <Pegasus/Common/HTTPAcceptor.h>
 #include <Pegasus/Common/MessageQueueService.h> #include <Pegasus/Common/MessageQueueService.h>
 #include <Pegasus/Common/Exception.h> #include <Pegasus/Common/Exception.h>
 #include "ArrayIterator.h" #include "ArrayIterator.h"
 #include "HostAddress.h" #include "HostAddress.h"
   #include <errno.h>
  
 PEGASUS_USING_STD; PEGASUS_USING_STD;
  
Line 75 
Line 75 
     _uninitialize();     _uninitialize();
 } }
  
   void Tickler::notify()
   {
       Socket::write(_clientSocket, "\0", 1);
   }
   
   void Tickler::reset()
   {
       // Clear all bytes from the tickle socket
       char buffer[32];
       while (Socket::read(_serverSocket, buffer, 32) > 0)
       {
       }
   }
   
 #if defined(PEGASUS_OS_TYPE_UNIX) #if defined(PEGASUS_OS_TYPE_UNIX)
  
 // Use an anonymous pipe for the tickle connection. // Use an anonymous pipe for the tickle connection.
Line 94 
Line 108 
  
     _serverSocket = fds[0];     _serverSocket = fds[0];
     _clientSocket = fds[1];     _clientSocket = fds[1];
   
       Socket::disableBlocking(_serverSocket);
 } }
  
 #else #else
Line 301 
Line 317 
     }     }
     catch (...)     catch (...)
     {     {
         PEG_TRACE_CSTRING(TRC_HTTP, Tracer::LEVEL4,          PEG_TRACE_CSTRING(TRC_HTTP, Tracer::LEVEL2,
             "Failed to close tickle sockets");             "Failed to close tickle sockets");
     }     }
     Socket::uninitializeInterface();     Socket::uninitializeInterface();
Line 326 
Line 342 
     // Create a MonitorEntry for the Tickler and set its state to IDLE so the     // Create a MonitorEntry for the Tickler and set its state to IDLE so the
     // Monitor will watch for its events.     // Monitor will watch for its events.
     _entries.append(MonitorEntry(     _entries.append(MonitorEntry(
         _tickler.getServerSocket(),          _tickler.getReadHandle(),
         1,         1,
         MonitorEntry::STATUS_IDLE,         MonitorEntry::STATUS_IDLE,
         MonitorEntry::TYPE_INTERNAL));          MonitorEntry::TYPE_TICKLER));
  
     // Start the count at 1 because _entries[0] is the Tickler     // Start the count at 1 because _entries[0] is the Tickler
     for (int i = 1; i < numberOfMonitorEntriesToAllocate; i++)     for (int i = 1; i < numberOfMonitorEntriesToAllocate; i++)
Line 346 
Line 362 
  
 void Monitor::tickle() void Monitor::tickle()
 { {
     Socket::write(_tickler.getClientSocket(), "\0", 1);      _tickler.notify();
 } }
  
 void Monitor::setState( void Monitor::setState(
Line 427 
Line 443 
                 continue;                 continue;
             }             }
             h._connectionClosePending = false;             h._connectionClosePending = false;
             MessageQueue &o = h.get_owner();              HTTPAcceptor &o = h.getOwningAcceptor();
             Message* message= new CloseConnectionMessage(entry.socket);             Message* message= new CloseConnectionMessage(entry.socket);
             message->dest = o.getQueueId();             message->dest = o.getQueueId();
  
Line 508 
Line 524 
  
     if (events == PEGASUS_SOCKET_ERROR)     if (events == PEGASUS_SOCKET_ERROR)
     {     {
         PEG_TRACE((TRC_HTTP, Tracer::LEVEL4,          PEG_TRACE((TRC_HTTP, Tracer::LEVEL1,
             "Monitor::run - select() returned error %d.", selectErrno));             "Monitor::run - select() returned error %d.", selectErrno));
         // The EBADF error indicates that one or more or the file         // The EBADF error indicates that one or more or the file
         // descriptions was not valid. This could indicate that         // descriptions was not valid. This could indicate that
Line 571 
Line 587 
                             }                             }
                             catch (...)                             catch (...)
                             {                             {
                                 PEG_TRACE_CSTRING(TRC_HTTP, Tracer::LEVEL2,                                  PEG_TRACE_CSTRING(TRC_HTTP, Tracer::LEVEL1,
                                     "Caught exception from "                                     "Caught exception from "
                                     "HTTPConnection::run()");                                     "HTTPConnection::run()");
                             }                             }
                             PEG_TRACE_CSTRING(TRC_HTTP, Tracer::LEVEL4,                             PEG_TRACE_CSTRING(TRC_HTTP, Tracer::LEVEL4,
                                 "Exited HTTPConnection::run()");                                 "Exited HTTPConnection::run()");
                             }                             }
   
   
                     }                     }
                     else if (entries[indx].type == MonitorEntry::TYPE_INTERNAL)                      else if (entries[indx].type == MonitorEntry::TYPE_TICKLER)
                     {                     {
                         char buffer;                          _tickler.reset();
                         Sint32 ignored =  
                             Socket::read(entries[indx].socket, &buffer, 1);  
                     }                     }
                     else                     else
                     {                     {
Line 593 
Line 605 
                             "Non-connection entry, indx = %d, has been "                             "Non-connection entry, indx = %d, has been "
                                 "received.",                                 "received.",
                             indx));                             indx));
                         int events = 0;  
                         events |= SocketMessage::READ;  
                         Message* msg = new SocketMessage(                         Message* msg = new SocketMessage(
                             entries[indx].socket, events);                              entries[indx].socket, SocketMessage::READ);
                         entries[indx].status = MonitorEntry::STATUS_BUSY;                         entries[indx].status = MonitorEntry::STATUS_BUSY;
                         _entriesMutex.unlock();                         _entriesMutex.unlock();
                         q->enqueue(msg);                         q->enqueue(msg);
Line 622 
Line 632 
  
             {             {
                 MessageQueue* q = MessageQueue::lookup(entries[indx].queueId);                 MessageQueue* q = MessageQueue::lookup(entries[indx].queueId);
                   PEGASUS_ASSERT(q != 0);
                 HTTPConnection *dst = reinterpret_cast<HTTPConnection *>(q);                 HTTPConnection *dst = reinterpret_cast<HTTPConnection *>(q);
                 dst->_entry_index = indx;                 dst->_entry_index = indx;
                 dst->closeConnectionOnTimeout(&timeNow);                 dst->closeConnectionOnTimeout(&timeNow);
Line 638 
Line 649 
                 entries[indx].type == MonitorEntry::TYPE_CONNECTION)                 entries[indx].type == MonitorEntry::TYPE_CONNECTION)
             {             {
                 MessageQueue* q = MessageQueue::lookup(entries[indx].queueId);                 MessageQueue* q = MessageQueue::lookup(entries[indx].queueId);
                   PEGASUS_ASSERT(q != 0);
                 HTTPConnection *dst = reinterpret_cast<HTTPConnection *>(q);                 HTTPConnection *dst = reinterpret_cast<HTTPConnection *>(q);
                 dst->_entry_index = indx;                 dst->_entry_index = indx;
                 dst->closeConnectionOnTimeout(&timeNow);                 dst->closeConnectionOnTimeout(&timeNow);


Legend:
Removed from v.1.130  
changed lines
  Added in v.1.137

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2