Author: rfm
Date: Tue Nov 29 09:32:39 2016
New Revision: 40241
URL: http://svn.gna.org/viewcvs/gnustep?rev=40241&view=rev
Log:
Make connection to process wait for regisdtration with Command server.
Add restart all option for Control
Modified:
libs/ec/trunk/EcControl.m
libs/ec/trunk/EcTest.m
Modified: libs/ec/trunk/EcControl.m
URL:
http://svn.gna.org/viewcvs/gnustep/libs/ec/trunk/EcControl.m?rev=40241&r1=40240&r2=40241&view=diff
==============================================================================
--- libs/ec/trunk/EcControl.m (original)
+++ libs/ec/trunk/EcControl.m Tue Nov 29 09:32:39 2016
@@ -1030,6 +1030,10 @@
{
m = @"Repeat\nRepeat the last command.\n";
}
+ else if (comp(wd, @"Restart") >= 0)
+ {
+ m = @"Restart all\nAsks all hosts to restart servers.\n";
+ }
else if (comp(wd, @"Set") >= 0)
{
m = @"Set\n"
@@ -1201,6 +1205,43 @@
exit(0);
}
}
+ else if (comp(wd, @"restart") >= 0)
+ {
+ wd = cmdWord(cmd, 1);
+ if ([wd length] > 0 && comp(wd, @"all") == 0)
+ {
+ NSUInteger i;
+ NSArray *hosts = [[commands copy] autorelease];
+
+ for (i = 0; i < [hosts count]; i++)
+ {
+ CommandInfo *c = [hosts objectAtIndex: i];
+
+ if ([commands indexOfObjectIdenticalTo: c] != NSNotFound)
+ {
+ NS_DURING
+ {
+ NSData *dat = [NSPropertyListSerialization
+ dataFromPropertyList: cmd
+ format: NSPropertyListBinaryFormat_v1_0
+ errorDescription: 0];
+ [[c obj] command: dat
+ to: nil
+ from: [console name]];
+ }
+ NS_HANDLER
+ {
+ NSLog(@"Caught: %@", localException);
+ }
+ NS_ENDHANDLER
+ }
+ }
+ }
+ else
+ {
+ m = @"Try 'restart all' or 'on host restart ...\n";
+ }
+ }
else if (comp(wd, @"set") >= 0)
{
m = @"ok - set confirmed.\n";
Modified: libs/ec/trunk/EcTest.m
URL:
http://svn.gna.org/viewcvs/gnustep/libs/ec/trunk/EcTest.m?rev=40241&r1=40240&r2=40241&view=diff
==============================================================================
--- libs/ec/trunk/EcTest.m (original)
+++ libs/ec/trunk/EcTest.m Tue Nov 29 09:32:39 2016
@@ -138,6 +138,26 @@
}
[NSThread sleepForTimeInterval: 0.1];
}
+ NS_DURING
+ {
+ if (YES == [(EcProcess*)proxy cmdIsClient])
+ {
+ if (NO == [(EcProcess*)proxy cmdIsConnected])
+ {
+ /* We must wait for the connected process to register
+ * with the Command server and configure itself.
+ */
+ proxy = nil;
+ [NSThread sleepForTimeInterval: 0.1];
+ }
+ }
+ }
+ NS_HANDLER
+ {
+ NSLog(@"Failed to communicate with '%@': %@",
+ name, localException);
+ }
+ NS_ENDHANDLER
}
[proxy retain];
DESTROY(pool);
_______________________________________________
Gnustep-cvs mailing list
[email protected]
https://mail.gna.org/listinfo/gnustep-cvs