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

Diff for /pegasus/src/Pegasus/Common/Socket.cpp between version 1.31.4.1 and 1.42

version 1.31.4.1, 2008/07/01 15:18:02 version 1.42, 2014/11/10 16:16:47
Line 1 
Line 1 
 //%2006////////////////////////////////////////////////////////////////////////  //%LICENSE////////////////////////////////////////////////////////////////
 // //
 // Copyright (c) 2000, 2001, 2002 BMC Software; Hewlett-Packard Development  // Licensed to The Open Group (TOG) under one or more contributor license
 // Company, L.P.; IBM Corp.; The Open Group; Tivoli Systems.  // agreements.  Refer to the OpenPegasusNOTICE.txt file distributed with
 // Copyright (c) 2003 BMC Software; Hewlett-Packard Development Company, L.P.;  // this work for additional information regarding copyright ownership.
 // IBM Corp.; EMC Corporation, The Open Group.  // Each contributor licenses this file to you under the OpenPegasus Open
 // Copyright (c) 2004 BMC Software; Hewlett-Packard Development Company, L.P.;  // Source License; you may not use this file except in compliance with the
 // IBM Corp.; EMC Corporation; VERITAS Software Corporation; The Open Group.  // License.
 // Copyright (c) 2005 Hewlett-Packard Development Company, L.P.; IBM Corp.;  
 // EMC Corporation; VERITAS Software Corporation; The Open Group.  
 // Copyright (c) 2006 Hewlett-Packard Development Company, L.P.; IBM Corp.;  
 // EMC Corporation; Symantec 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
 // of this software and associated documentation files (the "Software"), to  // copy of this software and associated documentation files (the "Software"),
 // deal in the Software without restriction, including without limitation the  // to deal in the Software without restriction, including without limitation
 // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or  // the rights to use, copy, modify, merge, publish, distribute, sublicense,
 // sell copies of the Software, and to permit persons to whom the Software is  // and/or sell copies of the Software, and to permit persons to whom the
 // furnished to do so, subject to the following conditions:  // Software is furnished to do so, subject to the following conditions:
 // //
 // THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN  // The above copyright notice and this permission notice shall be included
 // ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED  // in all copies or substantial portions of the Software.
 // "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT  
 // LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR  
 // PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT  
 // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN  
 // ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION  
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.  
 // //
 //==============================================================================  // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
   // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
   // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
   // IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
   // CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
   // TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
   // SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
   //
   //////////////////////////////////////////////////////////////////////////
 // //
 //%///////////////////////////////////////////////////////////////////////////// //%/////////////////////////////////////////////////////////////////////////////
  
Line 39 
Line 37 
 #include <Pegasus/Common/Logger.h> #include <Pegasus/Common/Logger.h>
 #include <Pegasus/Common/System.h> #include <Pegasus/Common/System.h>
 #include <Pegasus/Common/Tracer.h> #include <Pegasus/Common/Tracer.h>
   #include <Pegasus/Common/Threads.h>
   #include <Pegasus/Common/Mutex.h>
  
 PEGASUS_NAMESPACE_BEGIN PEGASUS_NAMESPACE_BEGIN
  
   #ifdef PEGASUS_OS_TYPE_WINDOWS
 static Uint32 _socketInterfaceRefCount = 0; static Uint32 _socketInterfaceRefCount = 0;
   static Mutex _socketInterfaceRefCountLock;
   #endif
  
 Boolean Socket::timedConnect( Boolean Socket::timedConnect(
     SocketHandle socket,     SocketHandle socket,
Line 51 
Line 54 
     Uint32 timeoutMilliseconds)     Uint32 timeoutMilliseconds)
 { {
     int connectResult;     int connectResult;
     PEGASUS_RETRY_SYSTEM_CALL(  #ifdef PEGASUS_OS_TYPE_WINDOWS
         ::connect(socket, address, addressLength), connectResult);      connectResult = ::connect(socket, address, addressLength);
   #else
       Uint32 maxConnectAttempts = 100;
       // Retry the connect() until it succeeds or it fails with an error other
       // than EINTR, EAGAIN (for Linux), or ECONNREFUSED (for HP-UX and z/OS).
       while (((connectResult = ::connect(socket, address, addressLength)) == -1)
              && (maxConnectAttempts-- > 0)
              && ((errno == EINTR) || (errno == EAGAIN) ||
                  (errno == ECONNREFUSED)))
       {
           Threads::sleep(1);
       }
   #endif
  
     if (connectResult == 0)     if (connectResult == 0)
     {     {
Line 73 
Line 88 
             { timeoutMilliseconds/1000, timeoutMilliseconds%1000*1000 };             { timeoutMilliseconds/1000, timeoutMilliseconds%1000*1000 };
         int selectResult = -1;         int selectResult = -1;
  
   #ifdef PEGASUS_OS_TYPE_WINDOWS
           PEGASUS_RETRY_SYSTEM_CALL(
               select(FD_SETSIZE, NULL, &fdwrite, &fdwrite, &timeoutValue),
               selectResult);
   #else
         PEGASUS_RETRY_SYSTEM_CALL(         PEGASUS_RETRY_SYSTEM_CALL(
             select(FD_SETSIZE, NULL, &fdwrite, NULL, &timeoutValue),             select(FD_SETSIZE, NULL, &fdwrite, NULL, &timeoutValue),
             selectResult);             selectResult);
   #endif
         if (selectResult == 0)         if (selectResult == 0)
         {         {
             PEG_TRACE_CSTRING(TRC_HTTP, Tracer::LEVEL1,             PEG_TRACE_CSTRING(TRC_HTTP, Tracer::LEVEL1,
Line 128 
Line 149 
 #endif #endif
 } }
  
   Sint32 Socket::peek(SocketHandle socket, void* ptr, Uint32 size)
   {
       #ifdef PEGASUS_OS_TYPE_WINDOWS
       return ::recv(socket, (char*)ptr, size, MSG_PEEK);
       #else
       int status;
       PEGASUS_RETRY_SYSTEM_CALL(::recv(socket, (char*)ptr, size, MSG_PEEK),
               status);
       return status;
       #endif
   }
   
 Sint32 Socket::write(SocketHandle socket, const void* ptr, Uint32 size) Sint32 Socket::write(SocketHandle socket, const void* ptr, Uint32 size)
 { {
 #ifdef PEGASUS_OS_TYPE_WINDOWS #ifdef PEGASUS_OS_TYPE_WINDOWS
Line 244 
Line 277 
 void Socket::initializeInterface() void Socket::initializeInterface()
 { {
 #ifdef PEGASUS_OS_TYPE_WINDOWS #ifdef PEGASUS_OS_TYPE_WINDOWS
       AutoMutex mtx(_socketInterfaceRefCountLock);
     if (_socketInterfaceRefCount == 0)     if (_socketInterfaceRefCount == 0)
     {     {
         WSADATA tmp;         WSADATA tmp;
Line 265 
Line 299 
 void Socket::uninitializeInterface() void Socket::uninitializeInterface()
 { {
 #ifdef PEGASUS_OS_TYPE_WINDOWS #ifdef PEGASUS_OS_TYPE_WINDOWS
       AutoMutex mtx(_socketInterfaceRefCountLock);
     _socketInterfaceRefCount--;     _socketInterfaceRefCount--;
  
     if (_socketInterfaceRefCount == 0)     if (_socketInterfaceRefCount == 0)
Line 291 
Line 326 
    int opt = 1;    int opt = 1;
    setsockopt(socket, IPPROTO_TCP, TCP_NODELAY, (char*)&opt, sizeof(opt));    setsockopt(socket, IPPROTO_TCP, TCP_NODELAY, (char*)&opt, sizeof(opt));
 } }
 //------------------------------------------------------------------------------  
 //  #ifdef PEGASUS_OS_ZOS
 // _setInformIfNewTCPIP()  
 //  
 //------------------------------------------------------------------------------  
 inline void _setInformIfNewTCPIP(SocketHandle socket) inline void _setInformIfNewTCPIP(SocketHandle socket)
 { {
 #ifdef PEGASUS_OS_ZOS  
    // This function enables the notification of the CIM Server that a new    // This function enables the notification of the CIM Server that a new
    // TCPIP transport layer is active. This is needed to be aware of a    // TCPIP transport layer is active. This is needed to be aware of a
    // restart of the transport layer. When this option is in effect,    // restart of the transport layer. When this option is in effect,
Line 312 
Line 343 
        SO_EioIfNewTP,        SO_EioIfNewTP,
        (char*)&NewTcpipOn,        (char*)&NewTcpipOn,
        sizeof(NewTcpipOn));        sizeof(NewTcpipOn));
 #endif  
 } }
   #else
   inline void _setInformIfNewTCPIP(SocketHandle)
   {
   }
   #endif
  
  
 SocketHandle Socket::createSocket(int domain, int type, int protocol) SocketHandle Socket::createSocket(int domain, int type, int protocol)
Line 325 
Line 360 
         return socket(domain,type,protocol);         return socket(domain,type,protocol);
     }     }
  
   #ifdef PEGASUS_OS_ZOS
     bool sendTcpipMsg = true;     bool sendTcpipMsg = true;
   #endif
  
     while (1)     while (1)
     {     {
Line 344 
Line 381 
         {         {
             Logger::put_l(             Logger::put_l(
                 Logger::STANDARD_LOG, System::CIMSERVER, Logger::INFORMATION,                 Logger::STANDARD_LOG, System::CIMSERVER, Logger::INFORMATION,
                   MessageLoaderParms(
                 "Common.Socket.WAIT_FOR_TCPIP",                 "Common.Socket.WAIT_FOR_TCPIP",
                 "TCP/IP temporary unavailable.");                      "TCP/IP temporary unavailable."));
             sendTcpipMsg = false;             sendTcpipMsg = false;
         }         }
  


Legend:
Removed from v.1.31.4.1  
changed lines
  Added in v.1.42

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2