(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.64 and 1.72

version 1.64, 2005/05/03 13:05:05 version 1.72, 2005/08/19 00:24:32
Line 41 
Line 41 
 //          Josephine Eskaline Joyce, IBM (jojustin@in.ibm.com) for Bug#2065 //          Josephine Eskaline Joyce, IBM (jojustin@in.ibm.com) for Bug#2065
 //          David Dillard, VERITAS Software Corp. //          David Dillard, VERITAS Software Corp.
 //              (david.dillard@veritas.com) //              (david.dillard@veritas.com)
   //          John Alex, IBM (johnalex@us.ibm.com) for Bug#3312
 // //
 //%///////////////////////////////////////////////////////////////////////////// //%/////////////////////////////////////////////////////////////////////////////
  
Line 81 
Line 82 
  
 PEGASUS_NAMESPACE_BEGIN PEGASUS_NAMESPACE_BEGIN
  
   
   //
   // Determine the correct type to use for the length passed to getsockname().
   // The default is to use the 'socklen_t'.
   //
   
   #if defined(PEGASUS_OS_TYPE_WINDOWS) || defined(PEGASUS_OS_OS400)
   #define PEGASUS_SOCKLEN_T   int
   #endif
   
   #if defined(PEGASUS_OS_HPUX) && !defined(_XOPEN_SOURCE_EXTENDED)
   #define PEGASUS_SOCKLEN_T   int
   #endif
   
   
   #if defined(PEGASUS_OS_VMS) || defined(PEGASUS_OS_ZOS)
   #define PEGASUS_SOCKLEN_T   unsigned
   #endif
   
   #ifndef PEGASUS_SOCKLEN_T
   #define PEGASUS_SOCKLEN_T   socklen_t
   #endif
   
 static int MAX_CONNECTION_QUEUE_LENGTH = -1; static int MAX_CONNECTION_QUEUE_LENGTH = -1;
  
  
Line 110 
Line 134 
             address_size = sizeof(struct sockaddr_in);             address_size = sizeof(struct sockaddr_in);
         }         }
     }     }
       ~HTTPAcceptorRep()
       {
           delete address;
       }
     struct sockaddr* address;     struct sockaddr* address;
  
 #if defined(PEGASUS_PLATFORM_ZOS_ZSERIES_IBM) || defined(PEGASUS_OS_VMS) #if defined(PEGASUS_PLATFORM_ZOS_ZSERIES_IBM) || defined(PEGASUS_OS_VMS)
Line 190 
Line 217 
  
 HTTPAcceptor::~HTTPAcceptor() HTTPAcceptor::~HTTPAcceptor()
 { {
      destroyConnections();
    unbind();    unbind();
    // ATTN: Is this correct in a multi-HTTPAcceptor server?    // ATTN: Is this correct in a multi-HTTPAcceptor server?
    Socket::uninitializeInterface();    Socket::uninitializeInterface();
Line 200 
Line 228 
    if (! message)    if (! message)
       return;       return;
  
      PEGASUS_ASSERT(_rep != 0);
    switch (message->getType())    switch (message->getType())
    {    {
       case SOCKET_MESSAGE:       case SOCKET_MESSAGE:
Line 303 
Line 332 
 void HTTPAcceptor::_bind() void HTTPAcceptor::_bind()
 { {
  
      PEGASUS_ASSERT(_rep != 0);
    // Create address:    // Create address:
  
    memset(_rep->address, 0, sizeof(*_rep->address));    memset(_rep->address, 0, sizeof(*_rep->address));
Line 425 
Line 455 
    if ( _portNumber == 0 )    if ( _portNumber == 0 )
    {    {
       sockaddr_in buf;       sockaddr_in buf;
       int bufSize = sizeof(buf);        PEGASUS_SOCKLEN_T bufSize = sizeof(buf);
       if ( getsockname(_rep->socket, reinterpret_cast<sockaddr *>(&buf), &bufSize) == 0 )       if ( getsockname(_rep->socket, reinterpret_cast<sockaddr *>(&buf), &bufSize) == 0 )
       {       {
           _portNumber = ntohs(buf.sin_port);           _portNumber = ntohs(buf.sin_port);
Line 512 
Line 542 
  
       // close the socket       // close the socket
       Socket::close(_rep->socket);       Socket::close(_rep->socket);
         // Unlink Local Domain Socket Bug# 3312
         if (_localConnection)
         {
   #ifndef PEGASUS_DISABLE_LOCAL_DOMAIN_SOCKET
             PEG_TRACE_STRING(TRC_HTTP, Tracer::LEVEL2,
                           "HTTPAcceptor::closeConnectionSocket Unlinking local connection." );
            ::unlink(
                reinterpret_cast<struct sockaddr_un*>(_rep->address)->sun_path);
   #else
            PEGASUS_ASSERT(false);
   #endif
         }
   
    }    }
    else    else
    {    {
Line 542 
Line 585 
 Uint32 HTTPAcceptor::getOutstandingRequestCount() const Uint32 HTTPAcceptor::getOutstandingRequestCount() const
 { {
    Uint32 count = 0;    Uint32 count = 0;
      if (_rep)
      {
    AutoMutex autoMut(_rep->_connection_mut);    AutoMutex autoMut(_rep->_connection_mut);
    if (_rep->connections.size() > 0)    if (_rep->connections.size() > 0)
    {    {
       HTTPConnection* connection = _rep->connections[0];       HTTPConnection* connection = _rep->connections[0];
       count = connection->getRequestCount();       count = connection->getRequestCount();
    }    }
      }
    return count;    return count;
 } }
  
Line 591 
Line 635 
  
 void HTTPAcceptor::destroyConnections() void HTTPAcceptor::destroyConnections()
 { {
      if (_rep)
      {
    // For each connection created by this object:    // For each connection created by this object:
  
    AutoMutex autoMut(_rep->_connection_mut);    AutoMutex autoMut(_rep->_connection_mut);
Line 612 
Line 656 
    }    }
  
    _rep->connections.clear();    _rep->connections.clear();
      }
 } }
  
 void HTTPAcceptor::_acceptConnection() void HTTPAcceptor::_acceptConnection()
Line 690 
Line 734 
            "HTTPAcceptor - accept() success.  Socket: $1"            "HTTPAcceptor - accept() success.  Socket: $1"
            ,socket);            ,socket);
  
    // Create a new conection and add it to the connection list:     AutoPtr<MP_Socket> mp_socket(new MP_Socket(
          socket, _sslcontext, _sslContextObjectLock, _exportConnection));
  
    AutoPtr<MP_Socket> mp_socket(new MP_Socket(socket, _sslcontext, _exportConnection));     // Perform the SSL handshake, if applicable.  Make the socket non-blocking
      // for this operation so we can send it back to the Monitor's select() loop
      // if it takes a while.
   
      mp_socket->disableBlocking();
      Sint32 socketAcceptStatus = mp_socket->accept();
      mp_socket->enableBlocking();
  
    Sint32 retVal;     if (socketAcceptStatus < 0)
   
    if (_sslcontext)  
    {  
        //  
        // For SSL connections, obtain read lock to SSLContext object before  
        // calling the accept() method of MP_Socket.  
        //  
        ReadLock rlock(*_sslContextObjectLock);  
        retVal = mp_socket->accept();  
    }  
    else  
    {  
        retVal = mp_socket->accept();  
    }  
   
    if (retVal < 0)  
    {    {
        PEG_TRACE_STRING(TRC_DISCARDED_DATA, Tracer::LEVEL2,        PEG_TRACE_STRING(TRC_DISCARDED_DATA, Tracer::LEVEL2,
                         "HTTPAcceptor: SSL_accept() failed");                         "HTTPAcceptor: SSL_accept() failed");
Line 718 
Line 753 
        return;        return;
    }    }
  
      // Create a new connection and add it to the connection list:
   
    HTTPConnection* connection = new HTTPConnection(_monitor, mp_socket,    HTTPConnection* connection = new HTTPConnection(_monitor, mp_socket,
        this, static_cast<MessageQueue *>(_outputMessageQueue), _exportConnection);        this, static_cast<MessageQueue *>(_outputMessageQueue), _exportConnection);
  
      if (socketAcceptStatus == 0)
      {
          PEG_TRACE_STRING(TRC_HTTP, Tracer::LEVEL2,
              "HTTPAcceptor: SSL_accept() pending");
          connection->_acceptPending = true;
      }
   
    // Solicit events on this new connection's socket:    // Solicit events on this new connection's socket:
    int index;    int index;
  


Legend:
Removed from v.1.64  
changed lines
  Added in v.1.72

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2