- service probing on refresh enabled
authorJan Kupec <jkupec@suse.cz>
Thu, 11 Sep 2008 23:22:27 +0000 (23:22 +0000)
committerJan Kupec <jkupec@suse.cz>
Thu, 11 Sep 2008 23:22:27 +0000 (23:22 +0000)
- some cleanup

zypp/RepoInfo.h
zypp/RepoManager.cc
zypp/ServiceInfo.cc
zypp/ServiceInfo.h

index f158a01..f22eb8e 100644 (file)
@@ -68,7 +68,7 @@ namespace zypp
 
     public:
     RepoInfo();
-    ~RepoInfo();
+    virtual ~RepoInfo();
 
     /**
      * Repository priority for solver.
index c1a1718..208dc11 100644 (file)
@@ -1470,22 +1470,26 @@ namespace zypp
 
   void RepoManager::refreshServices()
   {
-    // cannot user for_, because it uses const version
-    for (ServiceConstIterator it = _pimpl->services.begin();
-      it != _pimpl->services.end(); ++it)
+    // copy the set of services since refreshService
+    // can eventually invalidate the iterator
+    ServiceSet services;
+    services.insert(serviceBegin(), serviceEnd());
+    for_(it, services.begin(), services.end())
     {
       if ( !it->enabled() )
         continue;
 
-      MIL << "refresh: " << it->alias() << " with url: "<< it->url().asString() << endl;
       refreshService(*it);
     }
   }
 
   void RepoManager::refreshService( const ServiceInfo & service )
   {
+    MIL << "going to refresh service '" << service.alias()
+        << "', url: "<< service.url().asString() << endl;
+
     //! \todo add callbacks for apps (start, end, repo removed, repo added, repo changed)
-/*
+
     repo::ServiceType type = service.type();
     // if the type is unknown, try probing.
     if ( type == repo::ServiceType::NONE )
@@ -1504,13 +1508,13 @@ namespace zypp
           {
             ServiceInfo modifiedservice = service;
             modifiedservice.setType(type);
-            modifyService(service.alias(), modifiedservice); // FIXME this causes a segfault, whe the same code from repos doesn't?
+            modifyService(service.alias(), modifiedservice);
             break;
           }
         }
       }
     }
-*/
+
     // download the repo index file
     media::MediaManager mediamanager;
     //if (service.url().empty())
index acd0f7a..f30d2b3 100644 (file)
@@ -55,9 +55,19 @@ namespace zypp
     CatalogsToDisable catalogsToDisable;
 
   public:
-    Impl() : repo::RepoInfoBase::Impl() {}
-
-    Impl(const Url & url_) : url(url_) {}
+    Impl()
+      : repo::RepoInfoBase::Impl()
+      , type(repo::ServiceType::NONE_e)
+    {}
+
+    Impl(const Url & url_)
+      : repo::RepoInfoBase::Impl()
+      , url(url_)
+      , type(repo::ServiceType::NONE_e)
+    {}
+
+    ~Impl()
+    {}
     
     void setProbedType( const repo::ServiceType & t ) const
     {
@@ -97,6 +107,9 @@ namespace zypp
     : repo::RepoInfoBase(alias), _pimpl( new Impl(url) )
   {}
 
+  ServiceInfo::~ServiceInfo()
+  {}
+
   Url ServiceInfo::url() const { return _pimpl->url; }
   void ServiceInfo::setUrl( const Url& url ) { _pimpl->url = url; }
 
index ebf825b..a366b7f 100644 (file)
@@ -51,6 +51,8 @@ namespace zypp
      */
     ServiceInfo( const std::string & alias, const Url& url );
 
+    virtual ~ServiceInfo();
+
   public:
     /** Represents an empty service. */
     static const ServiceInfo noService;