(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.87 and 1.88

version 1.87, 2006/09/29 19:40:57 version 1.88, 2006/10/04 11:20:36
Line 94 
Line 94 
     Array<HTTPConnection*> connections;     Array<HTTPConnection*> connections;
 }; };
  
 //------------------------------------------------------------------------------  
 //  
 // _setTCPNoDelay()  
 //  
 //------------------------------------------------------------------------------  
   
 inline void _setTCPNoDelay(SocketHandle socket)  
 {  
     // This function disables "Nagle's Algorithm" also known as "the TCP delay  
     // algorithm", which causes read operations to obtain whatever data is  
     // already in the input queue and then wait a little longer to see if  
     // more data arrives. This algorithm optimizes the case in which data is  
     // sent in only one direction but severely impairs performance of round  
     // trip servers. Disabling TCP delay is a standard technique for round  
     // trip servers.  
   
    int opt = 1;  
    setsockopt(socket, IPPROTO_TCP, TCP_NODELAY, (char*)&opt, sizeof(opt));  
 }  
  
 //////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
 // //
Line 325 
Line 306 
  
    if (_localConnection)    if (_localConnection)
    {    {
        _rep->socket = socket(AF_UNIX, SOCK_STREAM, 0);         _rep->socket = Socket::createSocket(AF_UNIX, SOCK_STREAM, 0);
    }    }
    else    else
    {    {
        _rep->socket = socket(PF_INET, SOCK_STREAM, IPPROTO_TCP);         _rep->socket = Socket::createSocket(PF_INET, SOCK_STREAM, IPPROTO_TCP);
  
        _setTCPNoDelay(_rep->socket);  
    }    }
  
    if (_rep->socket < 0)    if (_rep->socket < 0)
Line 540 
Line 520 
    }    }
 } }
  
   
   /**
      reconnectConnectionSocket - creates a new server socket.
   */
   void HTTPAcceptor::reconnectConnectionSocket()
   {
      if (_rep)
      {
         // unregister the socket
         _monitor->unsolicitSocketMessages(_rep->socket);
         // close the 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::reconnectConnectionSocket Unlinking local connection." );
            ::unlink(
                reinterpret_cast<struct sockaddr_un*>(_rep->address)->sun_path);
   #else
            PEGASUS_ASSERT(false);
   #endif
         }
         // open the socket
         _bind();
      }
      else
      {
         PEG_TRACE_STRING(TRC_DISCARDED_DATA, Tracer::LEVEL2,
                           "HTTPAcceptor::reconnectConnectionSocket failure _rep is null." );
      }
   }
   
 /** /**
    getOutstandingRequestCount - returns the number of outstanding requests.    getOutstandingRequestCount - returns the number of outstanding requests.
 */ */
Line 653 
Line 667 
  
    SocketHandle socket = accept(_rep->socket, accept_address, &address_size);    SocketHandle socket = accept(_rep->socket, accept_address, &address_size);
  
    if (socket < 0)     if (socket == PEGASUS_SOCKET_ERROR)
      {
          // the remote connection is invalid, destroy client address.
          delete accept_address;
   
          // TCPIP is down reconnect this acceptor
          if(getSocketError() == PEGASUS_NETWORK_TCPIP_STOPPED)
    {    {
  
              PEG_TRACE_STRING(TRC_DISCARDED_DATA, Tracer::LEVEL2,
                       "Socket has an IO error. TCP/IP down. Try to reconnect." );
   
              reconnectConnectionSocket();
   
              return;
          }
        Logger::put(Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE,        Logger::put(Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE,
            "HTTPAcceptor - accept() failure.  errno: $0"            "HTTPAcceptor - accept() failure.  errno: $0"
            ,errno);            ,errno);


Legend:
Removed from v.1.87  
changed lines
  Added in v.1.88

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2