Diff for /Amaya/amaya/query.c between versions 1.381 and 1.382

version 1.381, 2009/01/28 12:13:35 version 1.382, 2009/02/05 09:01:06
Line 610  ThotBool  AHTReqContext_delete (AHTReqCo Line 610  ThotBool  AHTReqContext_delete (AHTReqCo
   
 #ifdef DAV /* if there is a DAV context object, delete it */  #ifdef DAV /* if there is a DAV context object, delete it */
       if (me->dav_context)        if (me->dav_context)
         AHTDAVContext_delete ((AHTDAVContext*)me->dav_context);          AHTDAVContext_delete ((AHTDAVContext*)(me->dav_context));
       me->dav_context = NULL;        me->dav_context = NULL;
 #endif /* DAV */  #endif /* DAV */
   
Line 663  ThotBool  AHTReqContext_delete (AHTReqCo Line 663  ThotBool  AHTReqContext_delete (AHTReqCo
         {          {
           if (me->outputfile && me->outputfile[0] != EOS)            if (me->outputfile && me->outputfile[0] != EOS)
             {              {
               TtaFileUnlink (me->outputfile);                TtaFileUnlink ((const char *) &(me->outputfile[0]));
               me->outputfile[0] = EOS;                me->outputfile[0] = EOS;
             }              }
         }          }
Line 759  static void Thread_deleteAll (void) Line 759  static void Thread_deleteAll (void)
 /*----------------------------------------------------------------------  /*----------------------------------------------------------------------
   AHTOpen_file    AHTOpen_file
   ----------------------------------------------------------------------*/    ----------------------------------------------------------------------*/
 int                 AHTOpen_file (HTRequest * request)  int AHTOpen_file (HTRequest * request)
 {  {
   AHTReqContext      *me;      /* current request */    AHTReqContext      *me;      /* current request */
   
Line 1764  static void         AHTAcceptLanguagesIn Line 1764  static void         AHTAcceptLanguagesIn
   Bindings between a source media type and a destination media type    Bindings between a source media type and a destination media type
   (conversion).    (conversion).
   ----------------------------------------------------------------------*/    ----------------------------------------------------------------------*/
 static void         AHTConverterInit (HTList *c)  static void  AHTConverterInit (HTList *c)
 {  {
   /* Handler for custom http error messages */    /* Handler for custom http error messages */
   HTConversion_add (c, "*/*", "www/debug", AHTMemConverter, 1.0, 0.0, 0.0);    HTConversion_add (c, "*/*", "www/debug", AHTMemConverter, 1.0, 0.0, 0.0);
Line 1838  static void         AHTProtocolInit (voi Line 1838  static void         AHTProtocolInit (voi
 #ifdef AMAYA_WWW_CACHE  #ifdef AMAYA_WWW_CACHE
   HTProtocol_add("cache",  "local", 0, YES, HTLoadCache, NULL);    HTProtocol_add("cache",  "local", 0, YES, HTLoadCache, NULL);
 #endif /* AMAYA_WWW_CACHE */  #endif /* AMAYA_WWW_CACHE */
 #if 0 /* experimental code */  
 #endif  
   HTProtocol_add ("ftp", "tcp", FTP_PORT, NO, HTLoadFTP, NULL);    HTProtocol_add ("ftp", "tcp", FTP_PORT, NO, HTLoadFTP, NULL);
   
   /* initialize pipelining */    /* initialize pipelining */
Line 1921  static void         AHTAlertInit (void) Line 1919  static void         AHTAlertInit (void)
   RecCleanCache    RecCleanCache
   Clears an existing cache directory    Clears an existing cache directory
   ----------------------------------------------------------------------*/    ----------------------------------------------------------------------*/
 static void RecCleanCache (char *dirname)  static ThotBool RecCleanCache (char *dirname)
 {  {
   char     buf[MAX_LENGTH];    char     buf[MAX_LENGTH];
   wxString name, path;    wxString name, path;
Line 1930  static void RecCleanCache (char *dirname Line 1928  static void RecCleanCache (char *dirname
   
   /* try to delete the current directory */    /* try to delete the current directory */
   if (wxRmdir(wx_dir_name))    if (wxRmdir(wx_dir_name))
     return;      return TRUE;
   
   /* try to delete the files & directorys inside */    /* try to delete the files & directorys inside */
   wxDir wx_dir(wx_dir_name);    wxDir wx_dir(wx_dir_name);
Line 1954  static void RecCleanCache (char *dirname Line 1952  static void RecCleanCache (char *dirname
         wxRemoveFile(path);          wxRemoveFile(path);
     }      }
   /* try to delete the current directory */    /* try to delete the current directory */
   wxRmdir(wx_dir_name);    if (wxRmdir(wx_dir_name))
       return TRUE;
     return FALSE;
 }  }
 #endif /* AMAYA_WWW_CACHE */  #endif /* AMAYA_WWW_CACHE */
   
Line 1966  void libwww_CleanCache (void) Line 1966  void libwww_CleanCache (void)
 {  {
 #ifdef AMAYA_WWW_CACHE  #ifdef AMAYA_WWW_CACHE
   char    *real_dir, *cache_dir, *tmp, *ptr;    char    *real_dir, *cache_dir, *tmp, *ptr;
   int      cache_size;    int      cache_size, cache_expire, cache_disconnect;
   int      cache_expire;    int      retry = 20;
   int      cache_disconnect;  
   
   if (!HTCacheMode_enabled ())    if (!HTCacheMode_enabled ())
     /* don't do anything if we're not using a cache */      /* don't do anything if we're not using a cache */
Line 2003  void libwww_CleanCache (void) Line 2002  void libwww_CleanCache (void)
   clear_cachelock ();    clear_cachelock ();
   HTCacheTerminate ();    HTCacheTerminate ();
   HTCacheMode_setEnabled (FALSE);    HTCacheMode_setEnabled (FALSE);
       // On Mac OS X it's necessary to relaunch the clean cache
   RecCleanCache (real_dir);    while (retry > 0 && !RecCleanCache (real_dir))
       retry --;
   HTCacheMode_setExpires ((HTExpiresMode)cache_expire);    HTCacheMode_setExpires ((HTExpiresMode)cache_expire);
   HTCacheMode_setDisconnected ((HTDisconnectedMode)cache_disconnect);    HTCacheMode_setDisconnected ((HTDisconnectedMode)cache_disconnect);
   HTCacheInit (cache_dir, cache_size);    HTCacheInit (cache_dir, cache_size);
Line 2095  static void CacheInit (void) Line 2095  static void CacheInit (void)
   cache_dir = HTLocalToWWW (real_dir, "file:");    cache_dir = HTLocalToWWW (real_dir, "file:");
   /* get the cache size (or use a default one) */    /* get the cache size (or use a default one) */
   ptr = TtaGetEnvString ("CACHE_SIZE");    ptr = TtaGetEnvString ("CACHE_SIZE");
   if (ptr && *ptr)     if (ptr && *ptr)
     cache_size = atoi (ptr);      cache_size = atoi (ptr);
   else    else
     cache_size = DEFAULT_CACHE_SIZE;      cache_size = DEFAULT_CACHE_SIZE;
Line 2109  static void CacheInit (void) Line 2109  static void CacheInit (void)
       strcpy (cache_lockfile, real_dir);        strcpy (cache_lockfile, real_dir);
       strcat (cache_lockfile, ".lock");        strcat (cache_lockfile, ".lock");
       cache_locked = FALSE;        cache_locked = FALSE;
       if ( TtaFileExist(cache_lockfile) &&        if (TtaFileExist(cache_lockfile))
            !(cache_locked = (test_cachelock(cache_lockfile) != 0))          {
            )            cache_locked = (test_cachelock(cache_lockfile) != 0);
         {            if (!cache_locked)
               {
 #ifdef DEBUG_LIBWWW  #ifdef DEBUG_LIBWWW
           fprintf (stderr, "found a stale cache, removing it\n");                fprintf (stderr, "found a stale cache, removing it\n");
 #endif /* DEBUG_LIBWWW */  #endif /* DEBUG_LIBWWW */
           /* remove the lock and clean the cache (the clean cache                 /* remove the lock and clean the cache (the clean cache 
              will remove all, making the following call unnecessary */                   will remove all, making the following call unnecessary */
           /* little trick to win some memory */                /* little trick to win some memory */
           ptr = strrchr (cache_lockfile, '.');                ptr = strrchr (cache_lockfile, '.');
           *ptr = EOS;                *ptr = EOS;
           RecCleanCache (cache_lockfile);                RecCleanCache (cache_lockfile);
           *ptr = '.';                *ptr = '.';
         }              }
           }
   
       if (!cache_locked)         if (!cache_locked) 
         {          {
           /* initialize the cache if there's no other amaya            /* initialize the cache if there's no other amaya
              instance running */               instance running */
           HTCacheMode_setMaxCacheEntrySize (cache_entry_size);            HTCacheMode_setMaxCacheEntrySize (cache_entry_size);
           if (TtaGetEnvBoolean ("CACHE_EXPIRE_IGNORE", &tmp_bool) && tmp_bool)            TtaGetEnvBoolean ("CACHE_EXPIRE_IGNORE", &tmp_bool);
             if (tmp_bool)
             HTCacheMode_setExpires (HT_EXPIRES_IGNORE);              HTCacheMode_setExpires (HT_EXPIRES_IGNORE);
           else            else
             HTCacheMode_setExpires (HT_EXPIRES_AUTO);              HTCacheMode_setExpires (HT_EXPIRES_AUTO);
Line 3586  void StopAllRequests (int docid) Line 3589  void StopAllRequests (int docid)
                       else                        else
                         {                          {
                           if (me->terminate_cbf)                            if (me->terminate_cbf)
                             (*me->terminate_cbf) (me->docid, -1, me->urlName,                              (*me->terminate_cbf) (me->docid, -1, &(me->urlName[0]),
                                                   me->outputfile,                                                    &(me->outputfile[0]),
                                                   NULL, NULL,                                                    NULL, NULL,
                                                   me->context_tcbf);                                                    me->context_tcbf);
                                                         

Removed from v.1.381  
changed lines
  Added in v.1.382


Webmaster