Don't exit program if state file could not be pared (for example corrupted or empty...
authorBjoern Sikora <bjoern.sikora@intra2net.com>
Tue, 16 Jul 2013 09:21:18 +0000 (11:21 +0200)
committerBjoern Sikora <bjoern.sikora@intra2net.com>
Tue, 16 Jul 2013 09:21:18 +0000 (11:21 +0200)
src/logger.cpp
src/serviceholder.cpp

index 37bc68d..dec7077 100644 (file)
@@ -867,7 +867,7 @@ void Logger::print_exception_deserialize(const string& errMsg) const
     if ( level <= Loglevel )
     {
         ostringstream msg;
-        msg << "Error while trying to de-serialize Serviceholder object: " << errMsg << endl;
+        msg << "Error while trying to de-serialize Serviceholder object: " << errMsg << ". Continue without recovering state from old services!" << endl;
         log_error(msg.str());
     }
 }
index c1c02e7..7f7968f 100644 (file)
@@ -132,10 +132,12 @@ int Serviceholder::deserialize_services()
         }
         catch( const boost::archive::archive_exception& e )
         {
+            // There is a corrupted object file, continue without recovering old Services' state.
             Log->print_exception_deserialize(e.what());
             ifs.close();
-            return -1;
+            return 0;
         }
+
         SerializeServiceContainer::Ptr service_container(_service_container);
         IPAddrHelp = IPAddrHelper::Ptr(_ip_addr_helper);
         ifs.close();