Author: rfm
Date: Tue Mar 25 19:44:47 2014
New Revision: 37766

URL: http://svn.gna.org/viewcvs/gnustep?rev=37766&view=rev
Log:
Improve startup when processes are started simultaneously with Command server.

Modified:
    libs/ec/trunk/ChangeLog
    libs/ec/trunk/EcProcess.m

Modified: libs/ec/trunk/ChangeLog
URL: 
http://svn.gna.org/viewcvs/gnustep/libs/ec/trunk/ChangeLog?rev=37766&r1=37765&r2=37766&view=diff
==============================================================================
--- libs/ec/trunk/ChangeLog     (original)
+++ libs/ec/trunk/ChangeLog     Tue Mar 25 19:44:47 2014
@@ -1,3 +1,9 @@
+2014-03-25  Richard Frith-Macdonald <[email protected]>
+
+       * EcConsole.m: Don't read from stdin whn in non-interactive mode
+       * EcProcess.m: Allow up to ten seconds to Contact Command server
+       on startup.
+
 2014-03-18  Richard Frith-Macdonald <[email protected]>
 
        * ECCL.h:

Modified: libs/ec/trunk/EcProcess.m
URL: 
http://svn.gna.org/viewcvs/gnustep/libs/ec/trunk/EcProcess.m?rev=37766&r1=37765&r2=37766&view=diff
==============================================================================
--- libs/ec/trunk/EcProcess.m   (original)
+++ libs/ec/trunk/EcProcess.m   Tue Mar 25 19:44:47 2014
@@ -1904,7 +1904,16 @@
        */
       if (cmdLast == nil || [cmdLast timeIntervalSinceNow] < -10.0)
        {
+          int   mayRetry;
+
          connecting = YES;
+
+          /* The first time we try to connect to the Command server
+           * (on startup) we should retry for several seconds in case
+           * the whole system is coming up and the Command server has
+           * not yet been started.
+           */
+          mayRetry = (nil == cmdLast ? 10 : 0);
 
          ASSIGN(cmdLast, [dateClass date]);
          if (cmdFirst == nil)
@@ -1920,13 +1929,24 @@
 
              NS_DURING
                {
+                  NSSocketPortNameServer        *ns;
+
                  host = ecCommandHost();
                  name = ecCommandName();
 
+                  ns = [NSSocketPortNameServer sharedInstance];
                  proxy = [NSConnection
                    rootProxyForConnectionWithRegisteredName: name
                                                        host: host
-                   usingNameServer: [NSSocketPortNameServer sharedInstance]];
+                                             usingNameServer: ns];
+                  while (nil == proxy && mayRetry-- > 0)
+                    {
+                      [NSThread sleepForTimeInterval: 1.0];
+                      proxy = [NSConnection
+                        rootProxyForConnectionWithRegisteredName: name
+                                                            host: host
+                                                 usingNameServer: ns];
+                    }
                }
              NS_HANDLER
                {


_______________________________________________
Gnustep-cvs mailing list
[email protected]
https://mail.gna.org/listinfo/gnustep-cvs

Reply via email to