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

List:       kde-commits
Subject:    icecream/daemon
From:       Dirk Mueller <mueller () kde ! org>
Date:       2006-09-11 13:08:27
Message-ID: 1157980107.687900.24169.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 583122 by mueller:

always pass back the return value.. somehow we should use exceptions


 M  +38 -39    main.cpp  


--- trunk/icecream/daemon/main.cpp #583121:583122
@@ -671,55 +671,54 @@
     if (!installed_size) {
         trace() << "install environment failed" << endl;
         c->send_msg(EndMsg()); // shut up, we had an error
-        reannounce_environments(envbasedir, nodename);
-    } else {
-        trace() << "envs " << dump_internals() << endl;
-        cache_size += installed_size;
-        string current = emsg->target + "/" + emsg->name;
-        envs_last_use[current] = time( NULL );
-        trace() << "installed " << emsg->name << " size: " << installed_size
-                << " all: " << cache_size << endl;
+        return reannounce_environments(envbasedir, nodename);
+    }
+    trace() << "envs " << dump_internals() << endl;
+    cache_size += installed_size;
+    string current = emsg->target + "/" + emsg->name;
+    envs_last_use[current] = time( NULL );
+    trace() << "installed " << emsg->name << " size: " << installed_size
+        << " all: " << cache_size << endl;
 
-        time_t now = time( NULL );
-        while ( cache_size > cache_size_limit ) {
-            string oldest;
-            // I don't dare to use (time_t)-1
-            time_t oldest_time = time( NULL ) + 90000;
-            for ( map<string, time_t>::const_iterator it = envs_last_use.begin();
-                  it != envs_last_use.end(); ++it ) {
-                trace() << "das ist jetzt so: " << it->first << " " << it->second << \
                " " << oldest_time << endl;
-                // ignore recently used envs (they might be in use _right_ now)
-                if ( it->second < oldest_time && now - it->second > 200 ) {
-                    bool found = false;
-                    for (Clients::const_iterator it2 = clients.begin(); it2 != \
                clients.end(); ++it2)  {
-                        if (it2->second->status == Client::WAITCOMPILE ||
+    time_t now = time( NULL );
+    while ( cache_size > cache_size_limit ) {
+        string oldest;
+        // I don't dare to use (time_t)-1
+        time_t oldest_time = time( NULL ) + 90000;
+        for ( map<string, time_t>::const_iterator it = envs_last_use.begin();
+                it != envs_last_use.end(); ++it ) {
+            trace() << "das ist jetzt so: " << it->first << " " << it->second << " " \
<< oldest_time << endl; +            // ignore recently used envs (they might be in \
use _right_ now) +            if ( it->second < oldest_time && now - it->second > 200 \
) { +                bool found = false;
+                for (Clients::const_iterator it2 = clients.begin(); it2 != \
clients.end(); ++it2)  { +                    if (it2->second->status == \
                Client::WAITCOMPILE ||
                             it2->second->status == Client::WAITFORCHILD) {
 
-                            string envforjob = it2->second->job->targetPlatform() + \
                "/"
-                                               + \
                it2->second->job->environmentVersion();
-                            if (envforjob == it->first)
-                                found = true;
-                        }
+                        string envforjob = it2->second->job->targetPlatform() + "/"
+                            + it2->second->job->environmentVersion();
+                        if (envforjob == it->first)
+                            found = true;
                     }
-                    if (!found) {
-                        oldest_time = it->second;
-                        oldest = it->first;
-                    }
                 }
+                if (!found) {
+                    oldest_time = it->second;
+                    oldest = it->first;
+                }
             }
-            if ( oldest.empty() || oldest == current )
-                break;
-            size_t removed = remove_environment( envbasedir, oldest );
-            trace() << "removing " << envbasedir << " " << oldest << " " << \
                oldest_time << " " << removed << endl;
-            cache_size -= min( removed, cache_size );
-            envs_last_use.erase( oldest );
         }
-
-        reannounce_environments(envbasedir, nodename); // do that before the file \
compiles +        if ( oldest.empty() || oldest == current )
+            break;
+        size_t removed = remove_environment( envbasedir, oldest );
+        trace() << "removing " << envbasedir << " " << oldest << " " << oldest_time \
<< " " << removed << endl; +        cache_size -= min( removed, cache_size );
+        envs_last_use.erase( oldest );
     }
+
+    bool r = reannounce_environments(envbasedir, nodename); // do that before the \
file compiles  // we do that here so we're not given out in case of full discs
     maybe_stats(true);
-    return true;
+    return r;
 }
 
 bool Daemon::handle_get_native_env( MsgChannel *c )


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

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