You are viewing a plain text version of this content. The canonical link for it is here.
Posted to axis-cvs@ws.apache.org by sa...@apache.org on 2004/08/02 04:54:56 UTC

cvs commit: ws-axis/c/src/transport/libwww LibWWWTransport.cpp

samisa      2004/08/01 19:54:56

  Modified:    c/src/transport/libwww LibWWWTransport.cpp
  Log:
  Moved lib init/uninit to seperate function call from constructor/destructor
  to ensure thread safety.
  
  Revision  Changes    Path
  1.4       +32 -17    ws-axis/c/src/transport/libwww/LibWWWTransport.cpp
  
  Index: LibWWWTransport.cpp
  ===================================================================
  RCS file: /home/cvs/ws-axis/c/src/transport/libwww/LibWWWTransport.cpp,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- LibWWWTransport.cpp	15 Jul 2004 07:26:53 -0000	1.3
  +++ LibWWWTransport.cpp	2 Aug 2004 02:54:56 -0000	1.4
  @@ -35,16 +35,6 @@
   int terminate_handler (HTRequest * request, HTResponse * response,
                                  void * param, int status)
   {
  -    /*if (status == HT_LOADED && m_pResult ) {
  -        HTPrint("%s\n", HTChunk_m_pcData(m_pResult));
  -        HTChunk_delete(m_pResult);
  -    }*/
  -    //if (HTNet_isIdle())
  -    //if (HTNet_idle())
  -    //if (HTNet_isEmpty())
  -    HTRequest_forceFlush(request);
  -    HTPrint("req count %d\n",HTNet_count());
  -    HTEventList_stopLoop();
       return status;
   }
   
  @@ -71,7 +61,8 @@
   :m_pRequest(NULL), m_pResult(NULL), m_pcData(NULL), m_pcProxy(NULL), m_iBytesLeft(0), m_pcReceived(NULL)
   
   {
  -    //Create a new premptive client 
  +    //Samisa moveed to initializeLibrary
  +    /*//Create a new premptive client 
       HTProfile_newNoCacheClient("AxisCpp", "1.3");
       //Disable interactive mode, could be useful when debugging
       HTAlert_setInteractive(NO);
  @@ -79,7 +70,7 @@
       HTNet_addAfter(terminate_handler, NULL, NULL, HT_ALL, HT_FILTER_LAST);
       //How long we are going to wait for a response
       HTHost_setEventTimeout(20000);
  -
  +    */
       m_pRequest = HTRequest_new();
   
   }
  @@ -165,7 +156,7 @@
        
   int LibWWWTransport::openConnection()
   {
  -    //Samisa: I wonder is this should be an API call.
  +    //Samisa: I wonder this should be an API call.
       //It should not be the job of the upper layers to tell the trasport 
       //to open and close connections. Rather the transport should determine 
       //when to do that, when sendBytes is called
  @@ -312,7 +303,6 @@
       if (m_pResult)
           HTChunk_delete(m_pResult);
       m_pResult = HTLoadToChunk(m_pcEndpointUri, m_pRequest);
  -    HTEventList_loop(m_pRequest);
       
       if (m_pcReceived)
           free(m_pcReceived);
  @@ -330,9 +320,7 @@
       }
       else
           return TRANSPORT_FAILED;
  -//#endif //ifdef HT_EXT
   #else    
  -//#if !defined(HT_EXT)
   
       HTParentAnchor* src = NULL;
       HTAnchor * dst = NULL;
  @@ -364,7 +352,7 @@
       else
           return TRANSPORT_FAILED;
   
  -#endif //!defined(HT_EXT)
  +#endif 
   }
        
   void LibWWWTransport::setProxy(const char* pcProxyHost, unsigned int uiProxyPort)
  @@ -409,6 +397,33 @@
                   return AXIS_SUCCESS;
           }
           return AXIS_FAIL;
  +}
  +}
  +
  +extern "C" {
  +STORAGE_CLASS_INFO
  +void initializeLibrary(void)
  +{
  +    //Create a new non-premptive client
  +    //HTProfile_newNoCacheClient("AxisCpp", "1.3");
  +    //Create a new non-premptive client (in this case no event loop is required)
  +    HTProfile_newPreemptiveClient("AxisCpp", "1.3");
  +    //Disable interactive mode, could be useful when debugging
  +    HTAlert_setInteractive(NO);
  +    // Add our own filter to do the clean up after response received
  +    HTNet_addAfter(terminate_handler, NULL, NULL, HT_ALL, HT_FILTER_LAST);
  +    //How long we are going to wait for a response
  +    HTHost_setEventTimeout(50000);
  +
  +}
  +}
  +
  +extern "C" {
  +STORAGE_CLASS_INFO
  +void uninitializeLibrary(void)
  +{
  +    //Terminate libwww 
  +    HTProfile_delete();
   }
   }