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

Diff for /pegasus/src/Pegasus/Common/HTTPAcceptor.cpp between version 1.105 and 1.105.2.2

version 1.105, 2007/09/07 20:08:37 version 1.105.2.2, 2008/09/25 21:46:15
Line 49 
Line 49 
 # include <Pegasus/Common/PaseCcsid.h> # include <Pegasus/Common/PaseCcsid.h>
 #endif #endif
  
   #if defined(PEGASUS_OS_VXWORKS)
   # define HTTP_ACCEPTOR_MAX_CONNECTIONS 2
   #else
   # define HTTP_ACCEPTOR_MAX_CONNECTIONS Uint32(0xFFFFFFFF)
   //# define HTTP_ACCEPTOR_MAX_CONNECTIONS 2
   #endif
   
 PEGASUS_USING_STD; PEGASUS_USING_STD;
  
 PEGASUS_NAMESPACE_BEGIN PEGASUS_NAMESPACE_BEGIN
Line 192 
Line 199 
  
 void HTTPAcceptor::handleEnqueue(Message *message) void HTTPAcceptor::handleEnqueue(Message *message)
 { {
       Uint32 numConnections = HTTP_ACCEPTOR_MAX_CONNECTIONS;
   
     if (!message)     if (!message)
        return;        return;
  
Line 236 
Line 245 
                {                {
                    _monitor->unsolicitSocketMessages(socket);                    _monitor->unsolicitSocketMessages(socket);
                    _rep->connections.remove(i);                    _rep->connections.remove(i);
                      numConnections = _rep->connections.size();
                    delete connection;                    delete connection;
                    break;                    break;
                }                }
Line 252 
Line 262 
     }     }
  
     delete message;     delete message;
 }  
  
       // Re-enable connections if connection count falls below maximum.
   
       if (_entry_index == -1 && numConnections < HTTP_ACCEPTOR_MAX_CONNECTIONS)
       {
           startAcceptingConnections();
       }
   }
  
 void HTTPAcceptor::handleEnqueue() void HTTPAcceptor::handleEnqueue()
 { {
Line 709 
Line 725 
  
     // Accept the connection (populate the address):     // Accept the connection (populate the address):
  
     struct sockaddr* accept_address;      struct sockaddr* accept_address = 0;
     SocketLength address_size;     SocketLength address_size;
  
     if (_connectionType == LOCAL_CONNECTION)     if (_connectionType == LOCAL_CONNECTION)
Line 884 
Line 900 
  
     // Save the socket for cleanup later:     // Save the socket for cleanup later:
     connection->_entry_index = index;     connection->_entry_index = index;
       Uint32 numConnections;
       {
     AutoMutex autoMut(_rep->_connection_mut);     AutoMutex autoMut(_rep->_connection_mut);
     _rep->connections.append(connection);     _rep->connections.append(connection);
           numConnections = _rep->connections.size();
       }
   
       // Start accepting new connections when we exceeded maximum connections.
   
       if (numConnections >= HTTP_ACCEPTOR_MAX_CONNECTIONS)
       {
           stopAcceptingConnections();
       }
   }
   
   int HTTPAcceptor::startAcceptingConnections()
   {
       if ((_entry_index = _monitor->solicitSocketMessages(
           _rep->socket,
           SocketMessage::READ | SocketMessage::EXCEPTION,
           getQueueId(),
           Monitor::ACCEPTOR)) == -1)
       {
           return false;
       }
   
       return true;
   }
   
   void HTTPAcceptor::stopAcceptingConnections()
   {
       _monitor->unsolicitSocketMessages(_rep->socket);
       _entry_index = -1;
 } }
  
 PEGASUS_NAMESPACE_END PEGASUS_NAMESPACE_END


Legend:
Removed from v.1.105  
changed lines
  Added in v.1.105.2.2

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2