[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-core-devel
Subject:    kio_http speedup patch again
From:       Rik Hemsley <rik () kde ! org>
Date:       2002-03-30 11:16:36
[Download RAW message or body]

Here's my patch again, slightly altered from the last version, because I don't 
think we need a CC_VerifyNonLazy - the code in khtml (misc/loader.cpp) seems 
to force a reload at the right times anyway.

Please test - this should not stop sites like auto-refreshing webcam pages 
working. I tried it on a constantly changing, auto-refreshing page and it
works fine.

Rik

["faster_http.diff" (text/x-diff)]

Index: http.cc
===================================================================
RCS file: /home/kde/kdelibs/kioslave/http/http.cc,v
retrieving revision 1.470
diff -u -3 -p -r1.470 http.cc
--- http.cc	2002/03/23 04:26:55	1.470
+++ http.cc	2002/03/30 11:02:06
@@ -4037,12 +4037,46 @@ FILE* HTTPProtocol::checkCacheEntry( boo
    {
       if (m_request.cache == CC_Verify)
       {
+         kdDebug(7113) << "Cache verification..."<< endl;
+
          date = (time_t) strtoul(buffer, 0, 10);
-         // After the expire date we need to revalidate.
+         m_expireDate = date;
+
+         // For pages that do auto-refresh, we need the expire time low.
+         // For most pages, however, we don't need to do that, and it's
+         // good to avoid, because it reduces network traffic, and hence
+         // we don't have horrible latency due to waiting for the server
+         // to verify that our URLs don't need reloading yet.
+
+         // The idea is to simply put off revalidation for a few minutes,
+         // when it's unnecessary.
+
+         if (m_request.cache == CC_Verify)
+         {
+           const int delay = 10 * 60; // in seconds.
+
+           kdDebug(7113)
+             << "Adjusting time by " << delay << " seconds..." << endl;
+
+           // Set the date forward <delay> minutes (if we don't wrap the value.)
+
+           if (date + delay > date)
+             date += delay;
+         }
+         else
+         {
+           kdDebug(7113) << "Not adjusting time." << endl;
+         }
+
+         kdDebug(7113) << "Current date: " << currentDate << endl;
+         kdDebug(7113) << "Cache   date: " << date << endl;
+
          if (!date || difftime(currentDate, date) >= 0)
             m_bMustRevalidate = true;
-         m_expireDate = date;
+
+         kdDebug(7113) << "m_bMustRevalidate: " << m_bMustRevalidate << endl;
       }
+
    }
 
    // ETag


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic