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

Diff for /pegasus/src/Pegasus/Client/CIMClientRep.cpp between version 1.54 and 1.54.2.3

version 1.54, 2006/01/30 16:16:42 version 1.54.2.3, 2008/01/02 21:07:59
Line 46 
Line 46 
 // //
 //%///////////////////////////////////////////////////////////////////////////// //%/////////////////////////////////////////////////////////////////////////////
  
   // NOCHKSRC
   
 #include "CIMClientRep.h" #include "CIMClientRep.h"
  
 // l10n // l10n
Line 76 
Line 78 
     :     :
     MessageQueue(PEGASUS_QUEUENAME_CLIENT),     MessageQueue(PEGASUS_QUEUENAME_CLIENT),
     _timeoutMilliseconds(timeoutMilliseconds),     _timeoutMilliseconds(timeoutMilliseconds),
     _connected(false)      _connected(false),
       _doReconnect(false)
 { {
     //     //
     // Create Monitor and HTTPConnector     // Create Monitor and HTTPConnector
Line 163 
Line 166 
                                               _connectHost,                                               _connectHost,
                                               _connectPortNumber,                                               _connectPortNumber,
                                               _connectSSLContext.get(),                                               _connectSSLContext.get(),
                                                 _timeoutMilliseconds,
                                               responseDecoder.get()));                                               responseDecoder.get()));
  
     //     //
Line 188 
Line 192 
     _requestEncoder->setDataStorePointer(&perfDataStore);     _requestEncoder->setDataStorePointer(&perfDataStore);
     _responseDecoder->setDataStorePointer(&perfDataStore);     _responseDecoder->setDataStorePointer(&perfDataStore);
  
       _doReconnect = false;
     _connected = true;     _connected = true;
       _httpConnection->setSocketWriteTimeout(_timeoutMilliseconds/1000+1);
 } }
  
 void CIMClientRep::_disconnect() void CIMClientRep::_disconnect()
Line 218 
Line 224 
  
         _connected = false;         _connected = false;
     }     }
 }  
  
 void CIMClientRep::_reconnect()      // Reconnect no longer applies
 {      _doReconnect = false;
     _disconnect();  
     _authenticator.clearReconnect();      // Let go of the cached request message if we have one
     _connect();      _authenticator.setRequestMessage(0);
 } }
  
 void CIMClientRep::connect( void CIMClientRep::connect(
Line 1064 
Line 1069 
     const Uint32 expectedResponseMessageType     const Uint32 expectedResponseMessageType
 ) )
 { {
     if (!_connected)      if (!_connected && !_doReconnect)
     {     {
         request.reset();  
         throw NotConnectedException();         throw NotConnectedException();
     }     }
  
       if (_doReconnect)
       {
           _connect();
           _doReconnect = false;
       }
   
     String messageId = XmlWriter::getNextMessageId();     String messageId = XmlWriter::getNextMessageId();
     const_cast<String &>(request->messageId) = messageId;     const_cast<String &>(request->messageId) = messageId;
  
Line 1118 
Line 1128 
         // Check to see if incoming queue has a message         // Check to see if incoming queue has a message
         //         //
  
         Message* response = dequeue();          AutoPtr<Message> response(dequeue());
  
         if (response)          if (response.get())
         {         {
             // Shouldn't be any more messages in our queue             // Shouldn't be any more messages in our queue
             PEGASUS_ASSERT(getCount() == 0);             PEGASUS_ASSERT(getCount() == 0);
  
             //             //
             // Reconnect to reset the connection              // Close the connection if response contained a "Connection: Close"
             // if Server response contained a Connection: Close Header              // header (e.g. at authentication challenge)
             //             //
             if (response->getCloseConnect() == true){              if (response->getCloseConnect() == true)
                 _reconnect();              {
                   _disconnect();
                   _doReconnect = true;
                 response->setCloseConnect(false);                 response->setCloseConnect(false);
             }             }
  
Line 1143 
Line 1155 
             {             {
  
                 Exception* clientException =                 Exception* clientException =
                     ((ClientExceptionMessage*)response)->clientException;                      ((ClientExceptionMessage*)response.get())->clientException;
                 delete response;  
  
                 AutoPtr<Exception> d(clientException);                 AutoPtr<Exception> d(clientException);
  
Line 1197 
Line 1208 
             }             }
             else if (response->getType() == expectedResponseMessageType)             else if (response->getType() == expectedResponseMessageType)
             {             {
                 CIMResponseMessage* cimResponse = (CIMResponseMessage*)response;                  CIMResponseMessage* cimResponse =
                       (CIMResponseMessage*)response.get();
  
                 if (cimResponse->messageId != messageId)                 if (cimResponse->messageId != messageId)
                 {                 {
Line 1217 
Line 1229 
  
                     CIMClientResponseException responseException(mlString);                     CIMClientResponseException responseException(mlString);
  
                     delete response;  
                     throw responseException;                     throw responseException;
                 }                 }
  
Line 1234 
Line 1245 
                         cimResponse->cimException.getCode(),                         cimResponse->cimException.getCode(),
                         cimResponse->cimException.getMessage());                         cimResponse->cimException.getMessage());
                     cimException.setContentLanguages(responseContentLanguages);                     cimException.setContentLanguages(responseContentLanguages);
                     delete response;  
                     throw cimException;                     throw cimException;
                 }                 }
  
Line 1255 
Line 1265 
                    perfDataStore.handler_prt->handleClientOpPerformanceData(item);                    perfDataStore.handler_prt->handleClientOpPerformanceData(item);
  
                 }//end of if statmet that call the callback method                 }//end of if statmet that call the callback method
                 return response;                  return response.release();
             }             }
             else if (dynamic_cast<CIMRequestMessage*>(response) != 0)              else if (dynamic_cast<CIMRequestMessage*>(response.get()) != 0)
             {             {
                 // Respond to an authentication challenge                  //
                 _requestEncoder->enqueue(response);                  // Respond to an authentication challenge.
                   // Reconnect if the connection was closed.
                   //
                   if (_doReconnect)
                   {
                       _connect();
                   }
   
                   _requestEncoder->enqueue(response.release());
                 nowMilliseconds = TimeValue::getCurrentTime().toMilliseconds();                 nowMilliseconds = TimeValue::getCurrentTime().toMilliseconds();
                 stopMilliseconds = nowMilliseconds + _timeoutMilliseconds;                 stopMilliseconds = nowMilliseconds + _timeoutMilliseconds;
                 continue;                 continue;
Line 1278 
Line 1296 
  
                 CIMClientResponseException responseException(mlString);                 CIMClientResponseException responseException(mlString);
  
                 delete response;  
                 throw responseException;                 throw responseException;
             }             }
         }         }
Line 1290 
Line 1307 
     //     //
     // Reconnect to reset the connection (disregard late response)     // Reconnect to reset the connection (disregard late response)
     //     //
     try  
     {      _disconnect();
         _reconnect();      _authenticator.resetChallengeStatus();
     }      _doReconnect = true;
     catch (...)  
     {  
     }  
  
     //     //
     // Throw timed out exception:     // Throw timed out exception:


Legend:
Removed from v.1.54  
changed lines
  Added in v.1.54.2.3

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2