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

List:       kde-commits
Subject:    kdenonbeta/icecream/icecream/daemon
From:       Stephan Kulow <coolo () kde ! org>
Date:       2004-08-31 16:23:33
Message-ID: 20040831162333.D9BF99265 () office ! kde ! org
[Download RAW message or body]

CVS commit by coolo: 

mean, mean regression: don't hang forever (and eat client connections)
While I looked at the code I noticed a TODO to do


  M +33 -10    main.cpp   1.102


--- kdenonbeta/icecream/icecream/daemon/main.cpp  #1.101:1.102
@@ -529,4 +529,32 @@ int main( int argc, char ** argv )
 
         if ( !scheduler ) {
+
+            while ( !requests.empty() )
+            {
+                Compile_Request req = requests.front();
+                requests.pop();
+                delete req.first;
+                delete req.second;
+            }
+
+            while ( current_kids > 0 )
+            {
+                int status;
+                pid_t child = wait(&status);
+                current_kids--;
+                if ( child > 0 )
+                {
+                    jobmap.erase( child );
+                    Pidmap::iterator pid_it = pidmap.find( child );
+                    if ( pid_it != pidmap.end() ) {
+                        close( pid_it->second );
+                        pidmap.erase( pid_it );
+                    }
+                }
+            }
+
+            jobmap.clear();
+            pidmap.clear();
+
             trace() << "connect_scheduler\n";
             scheduler = connect_scheduler (netname, 2000, schedname);
@@ -536,5 +564,4 @@ int main( int argc, char ** argv )
                 continue;
             }
-            jobmap.clear();
         }
 
@@ -549,11 +576,4 @@ int main( int argc, char ** argv )
         scheduler->send_msg( lmsg );
 
-        // TODO: clean up the mess from before
-        // for now I just hope schedulers don't go up
-        // and down that often
-
-        while ( !requests.empty() )
-            requests.pop();
-
         while (1) {
             int acc_fd;
@@ -562,6 +582,9 @@ int main( int argc, char ** argv )
 
             if ( requests.size() + current_kids )
-/*                log_info() << "requests " << requests.size() << " "
-                  << current_kids << " (" << max_kids << ")\n";*/
+            {
+                log_info() << "requests " << requests.size() << " "
+                           << current_kids << " (" << max_kids << ")\n";
+            }
+
             if ( !requests.empty() && current_kids < max_kids ) {
                 Compile_Request req = requests.front();


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

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