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

List:       kde-commits
Subject:    branches/work/icecream-make-it-cool/services
From:       Dirk Mueller <mueller () kde ! org>
Date:       2007-07-18 20:54:48
Message-ID: 1184792088.091369.15058.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 689668 by mueller:

fix connect if scheduler is known


 M  +16 -6     comm.cpp  
 M  +1 -0      comm.h  


--- branches/work/icecream-make-it-cool/services/comm.cpp #689667:689668
@@ -1055,7 +1055,10 @@
     netname = "ICECREAM";
 
   if (!schedname.empty())
-    netname = ""; // take whatever the machine is giving us
+    {
+      netname = ""; // take whatever the machine is giving us
+      attempt_scheduler_connect();
+    }
   else
     ask_fd = open_send_broadcast ();
 }
@@ -1072,6 +1075,17 @@
   return (time (0) - time0 >= timeout);
 }
 
+void
+DiscoverSched::attempt_scheduler_connect()
+{
+
+    time0 = time(0) + MAX_SCHEDULER_PONG;
+    log_info() << "scheduler is on " << schedname << ":" << sport << " (net " << netname << ")\n";
+    if ((ask_fd = prepare_connect(schedname, sport, remote_addr)) >= 0)
+        fcntl(ask_fd, F_SETFL, O_NONBLOCK);
+}
+
+
 MsgChannel *
 DiscoverSched::try_get_scheduler ()
 {
@@ -1094,11 +1108,7 @@
       netname = buf2 + 1;
       close (ask_fd);
       ask_fd = -1;
-
-      time0 = time(0) + MAX_SCHEDULER_PONG;
-      log_info() << "scheduler is on " << schedname << ":" << sport << " (net " << netname << ")\n";
-      if ((ask_fd = prepare_connect(schedname, sport, remote_addr)) >= 0)
-        fcntl(ask_fd, F_SETFL, O_NONBLOCK);
+      attempt_scheduler_connect();
     }
 
   if (ask_fd >= 0)
--- branches/work/icecream-make-it-cool/services/comm.h #689667:689668
@@ -218,6 +218,7 @@
   int ask_fd;
   time_t time0;
   unsigned int sport;
+  void attempt_scheduler_connect();
 public:
   /* Connect to a scheduler waiting max. TIMEOUT milliseconds.
      schedname can be the hostname of a box running a scheduler, to avoid
[prev in list] [next in list] [prev in thread] [next in thread] 

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