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

version 1.65, 2005/05/03 20:43:09 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 86 
Line 87 
 // Determine the correct type to use for the length passed to getsockname(). // Determine the correct type to use for the length passed to getsockname().
 // The default is to use the 'socklen_t'. // The default is to use the 'socklen_t'.
 // //
 #if defined(PEGASUS_OS_TYPE_WINDOWS) || defined(PEGASUS_OS_ZOS) || defined(PEGASUS_OS_OS400)  
   #if defined(PEGASUS_OS_TYPE_WINDOWS) || defined(PEGASUS_OS_OS400)
 #define PEGASUS_SOCKLEN_T   int #define PEGASUS_SOCKLEN_T   int
 #endif #endif
  
Line 94 
Line 96 
 #define PEGASUS_SOCKLEN_T   int #define PEGASUS_SOCKLEN_T   int
 #endif #endif
  
 #ifdef PEGASUS_OS_VMS  
   #if defined(PEGASUS_OS_VMS) || defined(PEGASUS_OS_ZOS)
 #define PEGASUS_SOCKLEN_T   unsigned #define PEGASUS_SOCKLEN_T   unsigned
 #endif #endif
  
Line 131 
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 211 
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 221 
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 324 
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 533 
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 563 
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 612 
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 633 
Line 656 
    }    }
  
    _rep->connections.clear();    _rep->connections.clear();
      }
 } }
  
 void HTTPAcceptor::_acceptConnection() void HTTPAcceptor::_acceptConnection()
Line 711 
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));  
  
    Sint32 retVal;     // 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 (_sslcontext)     // if it takes a while.
    {  
        //     mp_socket->disableBlocking();
        // For SSL connections, obtain read lock to SSLContext object before     Sint32 socketAcceptStatus = mp_socket->accept();
        // calling the accept() method of MP_Socket.     mp_socket->enableBlocking();
        //  
        ReadLock rlock(*_sslContextObjectLock);  
        retVal = mp_socket->accept();  
    }  
    else  
    {  
        retVal = mp_socket->accept();  
    }  
  
    if (retVal < 0)     if (socketAcceptStatus < 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 739 
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.65  
changed lines
  Added in v.1.72

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2