[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-07-05 20:39:04
Message-ID: 1152131944.521029.26377.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 558684 by mueller:

a lot more error handling


 M  +1 -1      environment.cpp  
 M  +1 -1      environment.h  
 M  +19 -12    main.cpp  


--- trunk/icecream/daemon/environment.cpp #558683:558684
@@ -408,7 +408,7 @@
     _exit(execv( argv[0], argv ));
 }
 
-size_t remove_environment( const string &basename, const string &env, uid_t \
nobody_uid, gid_t nobody_gid ) +size_t remove_environment( const string &basename, \
const string &env )  {
     string::size_type pos = env.find_first_of( '/' );
     if ( pos == string::npos ) // nonsense
--- trunk/icecream/daemon/environment.h #558683:558684
@@ -34,6 +34,6 @@
                             const std::string &target,
                             const std::string &name,
                             MsgChannel *c, uid_t nobody_uid, gid_t nobody_gid );
-extern size_t remove_environment( const std::string &basedir, const std::string \
&env, uid_t nobody_uid, gid_t nobody_gid ); +extern size_t remove_environment( const \
std::string &basedir, const std::string &env);  
 #endif
--- trunk/icecream/daemon/main.cpp #558683:558684
@@ -654,7 +654,10 @@
         c->status = Client::PENDING_USE_CS;
     } else {
         c->usecsmsg = new UseCSMsg( msg->host_platform, msg->hostname, msg->port, \
                msg->job_id, true, 1 );
-        c->channel->send_msg( *msg );
+        if (!c->channel->send_msg( *msg )) {
+          handle_end(c, 143);
+          return 0;
+        }
         c->status = Client::WAITCOMPILE;
     }
     c->job_id = msg->job_id;
@@ -704,7 +707,7 @@
             }
             if ( oldest.empty() || oldest == current )
                 break;
-            size_t removed = remove_environment( envbasedir, oldest, nobody_uid, \
nobody_gid ); +            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 );
@@ -734,9 +737,12 @@
             return false;
         }
     }
+    UseNativeEnvMsg m( native_environment );
+    if (!c->send_msg( m )) {
+      handle_end(client, 138);
+      return false;
+    }
     client->status = Client::GOTNATIVE;
-    UseNativeEnvMsg m( native_environment );
-    c->send_msg( m );
     return true;
 }
 
@@ -786,11 +792,14 @@
     if ( client )
     {
         trace() << "pending " << client->dump() << endl;
-        client->channel->send_msg( *client->usecsmsg );
-        client->status = Client::CLIENTWORK;
-        /* we make sure we reserve a spot and the rest is done if the
-         * client contacts as back with a Compile request */
-        clients.active_processes++;
+        if(client->channel->send_msg( *client->usecsmsg )) {
+            client->status = Client::CLIENTWORK;
+            /* we make sure we reserve a spot and the rest is done if the
+             * client contacts as back with a Compile request */
+            clients.active_processes++;
+        }
+        else 
+            handle_end(client, 129);
     }
 
     if ( current_kids + clients.active_processes >= max_kids )
@@ -1203,9 +1212,7 @@
     LoginMsg lmsg( PORT, nodename, machine_name );
     lmsg.envs = available_environmnents(envbasedir);
     lmsg.max_kids = max_kids;
-    scheduler->send_msg( lmsg );
-
-    return true;
+    return scheduler->send_msg( lmsg );
 }
 
 int Daemon::working_loop()


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

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