]> git.mxchange.org Git - simgear.git/blobdiff - simgear/package/Catalog.cxx
Tweak HTTP code to always sleep.
[simgear.git] / simgear / package / Catalog.cxx
index 67b4eb19b910ff28a618e2cd3bad2c189a11a704..160d2fbf7cc45e917853c4289c93c04c02fa07d4 100644 (file)
@@ -50,17 +50,12 @@ public:
     }
     
 protected:
-    virtual void responseHeadersComplete()
-    {
-        
-    }
-    
     virtual void gotBodyData(const char* s, int n)
     {
         m_buffer += std::string(s, n);
     }
     
-    virtual void responseComplete()
+    virtual void onDone()
     {        
         if (responseCode() != 200) {
             SG_LOG(SG_GENERAL, SG_ALERT, "catalog download failure:" << m_owner->url());
@@ -290,6 +285,12 @@ unsigned int Catalog::ageInSeconds() const
     return (diff < 0) ? 0 : diff;
 }
 
+bool Catalog::needsRefresh() const
+{
+    unsigned int maxAge = m_props->getIntValue("max-age-sec", m_root->maxAgeSeconds());
+    return (ageInSeconds() > maxAge);
+}
+    
 std::string Catalog::getLocalisedString(const SGPropertyNode* aRoot, const char* aName) const
 {
     if (aRoot->hasChild(m_root->getLocale())) {