(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.49 and 1.52.2.2

version 1.49, 2004/05/21 20:57:00 version 1.52.2.2, 2005/02/18 23:59:17
Line 1 
Line 1 
 //%2003////////////////////////////////////////////////////////////////////////  //%2004////////////////////////////////////////////////////////////////////////
 // //
 // Copyright (c) 2000, 2001, 2002  BMC Software, Hewlett-Packard Development  // Copyright (c) 2000, 2001, 2002 BMC Software; Hewlett-Packard Development
 // Company, L. P., IBM Corp., The Open Group, Tivoli Systems.  // Company, L.P.; IBM Corp.; The Open Group; Tivoli Systems.
 // Copyright (c) 2003 BMC Software; Hewlett-Packard Development Company, L. P.; // Copyright (c) 2003 BMC Software; Hewlett-Packard Development Company, L. P.;
 // IBM Corp.; EMC Corporation, The Open Group. // IBM Corp.; EMC Corporation, The Open Group.
   // Copyright (c) 2004 BMC Software; 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 copy // Permission is hereby granted, free of charge, to any person obtaining a copy
 // of this software and associated documentation files (the "Software"), to // of this software and associated documentation files (the "Software"), to
Line 30 
Line 32 
 //         Nag Boranna, Hewlett-Packard Company (nagaraja_boranna@hp.com) //         Nag Boranna, Hewlett-Packard Company (nagaraja_boranna@hp.com)
 //         Dave Rosckes (rosckes@us.ibm.com) //         Dave Rosckes (rosckes@us.ibm.com)
 //         Denise Eckstein (denise.eckstein@hp.com) //         Denise Eckstein (denise.eckstein@hp.com)
   //         Alagaraja Ramasubramanian (alags_raj@in.ibm.com) for Bug#1090
 // //
 //%///////////////////////////////////////////////////////////////////////////// //%/////////////////////////////////////////////////////////////////////////////
  
Line 70 
Line 73 
  
 PEGASUS_NAMESPACE_BEGIN PEGASUS_NAMESPACE_BEGIN
  
   static int MAX_CONNECTION_QUEUE_LENGTH = -1;
   
   
 //////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
 // //
 // HTTPAcceptorRep // HTTPAcceptorRep
Line 135 
Line 141 
      _exportConnection(exportConnection)      _exportConnection(exportConnection)
 { {
    Socket::initializeInterface();    Socket::initializeInterface();
   
      /*
           Platforms interpret the value of MAX_CONNECTION_QUEUE_LENGTH differently.  Some platforms interpret
           the value literally, while others multiply a fudge factor. When the server is under
           stress from multiple clients with multiple requests, toggling this number may prevent clients from
           being dropped.  Instead of hard coding the value, we allow an environment variable to be set which
           specifies a number greater than the maximum concurrent client connections possible.  If this environment
           var is not specified, then MAX_CONNECTION_QUEUE_LENGTH = 15.
      */
   
   //To engage runtime backlog queue length: uncomment the following block AND comment out the line MAX_CONNECTION_QUEUE_LENGTH = 15
   
   /*
      if(MAX_CONNECTION_QUEUE_LENGTH == -1){
   #ifdef PEGASUS_PLATFORM_OS400_ISERIES_IBM
   #pragma convert(37)
           const char* env = getenv("PEGASUS_MAX_BACKLOG_CONNECTION_QUEUE");
           EtoA(env);
   #pragma convert(0)
   #else
           const char* env = getenv("PEGASUS_MAX_BACKLOG_CONNECTION_QUEUE");
   #endif
           if(!env){
                   MAX_CONNECTION_QUEUE_LENGTH = 15;
           }else{
                   char *end = NULL;
                   MAX_CONNECTION_QUEUE_LENGTH = strtol(env, &end, 10);
                   if(*end)
                           MAX_CONNECTION_QUEUE_LENGTH = 15;
                   cout << " MAX_CONNECTION_QUEUE_LENGTH = " << MAX_CONNECTION_QUEUE_LENGTH << endl;
           }
      }
   */
      MAX_CONNECTION_QUEUE_LENGTH = 15;
   
 } }
  
 HTTPAcceptor::~HTTPAcceptor() HTTPAcceptor::~HTTPAcceptor()
Line 177 
Line 218 
          CloseConnectionMessage* closeConnectionMessage          CloseConnectionMessage* closeConnectionMessage
             = (CloseConnectionMessage*)message;             = (CloseConnectionMessage*)message;
  
          _rep->_connection_mut.lock(pegasus_thread_self());           AutoMutex autoMut(_rep->_connection_mut);
  
          for (Uint32 i = 0, n = _rep->connections.size(); i < n; i++)          for (Uint32 i = 0, n = _rep->connections.size(); i < n; i++)
          {          {
Line 192 
Line 233 
                break;                break;
             }             }
          }          }
          _rep->_connection_mut.unlock();  
          break;          break;
       }       }
  
Line 365 
Line 406 
       throw BindFailedException(parms);       throw BindFailedException(parms);
    }    }
  
      //
      //  Change permissions on Linux local domain socket to allow writes by others.
      //
   #if defined(PEGASUS_LOCAL_DOMAIN_SOCKET) && defined(PEGASUS_PLATFORM_LINUX_GENERIC_GNU)
      if (_localConnection)
      {
        if (::chmod( PEGASUS_LOCAL_DOMAIN_SOCKET_PATH,
                     S_IRUSR | S_IWUSR | S_IXUSR |
                     S_IRGRP | S_IWGRP | S_IXGRP |
                     S_IROTH | S_IWOTH | S_IXOTH ) < 0 )
        {
          Socket::close(_rep->socket);
          delete _rep;
          _rep = 0;
          //l10n
          //throw BindFailedException("Failed to bind socket");
          MessageLoaderParms parms("Common.HTTPAcceptor.FAILED_BIND_SOCKET",
                                  "Failed to bind socket");
          PEG_TRACE_STRING(TRC_DISCARDED_DATA, Tracer::LEVEL2,
                 "HTTPAcceptor::_bind: Failed to set domain socket permissions.");
          throw BindFailedException(parms);
        }
      }
   #endif
   
    // Set up listening on the given socket:    // Set up listening on the given socket:
  
    int const MAX_CONNECTION_QUEUE_LENGTH = 15;     //int const MAX_CONNECTION_QUEUE_LENGTH = 15;
  
    if (listen(_rep->socket, MAX_CONNECTION_QUEUE_LENGTH) < 0)    if (listen(_rep->socket, MAX_CONNECTION_QUEUE_LENGTH) < 0)
    {    {
Line 450 
Line 516 
 { {
    Uint32 count = 0;    Uint32 count = 0;
  
    _rep->_connection_mut.lock(pegasus_thread_self());     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();
    }    }
    _rep->_connection_mut.unlock();  
    return count;    return count;
 } }
  
Line 492 
Line 558 
  
    // For each connection created by this object:    // For each connection created by this object:
  
    _rep->_connection_mut.lock(pegasus_thread_self());     AutoMutex autoMut(_rep->_connection_mut);
    for (Uint32 i = 0, n = _rep->connections.size(); i < n; i++)    for (Uint32 i = 0, n = _rep->connections.size(); i < n; i++)
    {    {
       HTTPConnection* connection = _rep->connections[i];       HTTPConnection* connection = _rep->connections[i];
Line 509 
Line 575 
    }    }
  
    _rep->connections.clear();    _rep->connections.clear();
    _rep->_connection_mut.unlock();  
 } }
  
 void HTTPAcceptor::_acceptConnection() void HTTPAcceptor::_acceptConnection()
Line 594 
Line 660 
    {    {
        PEG_TRACE_STRING(TRC_DISCARDED_DATA, Tracer::LEVEL2,        PEG_TRACE_STRING(TRC_DISCARDED_DATA, Tracer::LEVEL2,
                         "HTTPAcceptor: SSL_accept() failed");                         "HTTPAcceptor: SSL_accept() failed");
         mp_socket->close();
       return;       return;
    }    }
  
Line 621 
Line 688 
  
    // Save the socket for cleanup later:    // Save the socket for cleanup later:
    connection->_entry_index = index;    connection->_entry_index = index;
    _rep->_connection_mut.lock(pegasus_thread_self());     AutoMutex autoMut(_rep->_connection_mut);
    _rep->connections.append(connection);    _rep->connections.append(connection);
    _rep->_connection_mut.unlock();  
 } }
  
 AsyncDQueue<pegasus_acceptor> pegasus_acceptor::acceptors(true, 0); AsyncDQueue<pegasus_acceptor> pegasus_acceptor::acceptors(true, 0);


Legend:
Removed from v.1.49  
changed lines
  Added in v.1.52.2.2

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2