Re: HTHostEventimeout: How do u cancle a timer

MessageI guess you are right. But it is strange that Timeout does not get deleted esp in my case where I am termintating the libwww library at end of each call and initialising it again all over for subesquent request...
By the way how did you found out about the timeout of 30 secs?

--Sandesh
  ----- Original Message ----- 
  From: Sinha, Raj (Raj) 
  To: www-lib@w3.org 
  Sent: Wednesday, October 08, 2003 7:30 PM
  Subject: HTHostEventimeout: How do u cancle a timer


  On the HostEventTimeout, I have a general question

  I have a similar application that launches a request recursively. What I do notice is that the timer that is started for a request (or rather the host) is not cancelled when the request is complete. It times out after the pre determined 30 seconds. IF we had launched another request then a new timer is started.

  My questions is : shouldn't the old timer (with the first request) be cancelled. I can see that it times out at the end of 30 seconds and tries to execute the call back function. If there is a method to do that can someone please point me to it. I would imagine that the library should take care of this automatically

  Thanks Raj




  Raj Sinha
  1 732 852 2077
  1H-318
  307 Middletown Lincroft Road
  Lincroft, NJ  07738-1526  U S


    -----Original Message-----
    From: Sandesh Anvekar [mailto:sanvekar@controlnet.co.in] 
    Sent: Saturday, February 08, 2003 1:38 AM
    To: www-lib@w3.org
    Subject: [www-lib] <none>


    Hi All,

        I have written a piece of code something like this and I am calling the function xrayhttpget after a fixed time interval repeatetively .But I have encountered a problem in this
    Suppose I give a valid uri of some html document and as I said my program logic will continuosly loop and try to fetch this document in each iteration .Also I have specified the 
    time gap between the successive requests is 3 seconds then during the second iteration my program gives segmentaion fault and it occurs due to the HTHost_setEventTimeout(3000);
    call in the code.Could anyone explain me why this could occur?

    Thanks
    Sandesh

    PRIVATE int request_terminater (HTRequest * request, HTResponse * response,
        void * param, int status) 
    {
        /*Stop the event loop and quit*/
        HTEventList_stopLoop ();
        return HT_OK;
    }

    /* ------------------------------------------------------------------------- */
    /* xrayhttpget will now accept the uri and length of the uri*/
    int xrayhttpget ( char * argv ,int len, int completeURI)
    {
     App * app = NULL;
     HTRequest * request = NULL;
     HTAnchor * anchor = NULL;

     /* Need our own trace and print functions */
     HTPrint_setCallback(printer);
     HTTrace_setCallback(tracer);
     char * uri = HTParse(argv, NULL, PARSE_ALL);
     if ((anchor = HTAnchor_findAddress(uri)) == NULL)
      anchor = HTAnchor_findAddress(DEFAULT_HOME);
     HT_FREE(uri);

    #if 0
     HTSetTraceMessageMask("sop");
    #endif

     /* Initiate libwww */
     libwww_setup();

     /* Create a new app obect */
     app = App_new();

     /* Add our own request terminate handler */
     HTNet_addAfter(request_terminater, NULL, app, HT_ALL, HT_FILTER_LAST);
     /*Set the timeout for request */
     HTHost_setEventTimeout(3000);
     /* Start request */
     request = Request_new(app ,argv ,len, completeURI);
     if(get_document(request, anchor) == YES) {
      /* Go into the event loop... */
      HTEventList_loop(request);
     }
         
     Request_delete(app, request);
     App_delete(app);
     return 0;
    }

Received on Thursday, 9 October 2003 01:00:56 UTC