Author: rfm
Date: Tue Sep 2 11:19:29 2014
New Revision: 38055
URL: http://svn.gna.org/viewcvs/gnustep?rev=38055&view=rev
Log:
ireliability and debug tweaks
Modified:
libs/ec/trunk/ChangeLog
libs/ec/trunk/EcAlerter.m
libs/ec/trunk/EcControl.m
Modified: libs/ec/trunk/ChangeLog
URL:
http://svn.gna.org/viewcvs/gnustep/libs/ec/trunk/ChangeLog?rev=38055&r1=38054&r2=38055&view=diff
==============================================================================
--- libs/ec/trunk/ChangeLog (original)
+++ libs/ec/trunk/ChangeLog Tue Sep 2 11:19:29 2014
@@ -1,3 +1,13 @@
+2014-09-02 Richard Frith-Macdonald <[email protected]>
+
+ * EcControl.m: If a Command server on a host registers and we already
+ have a Command server registered, have the new registration replace
+ the old one rather than rejecting it. The aim is to handle a race
+ condition where a Command server is re-registering after some network
+ problem and the old registration is still in place.
+ * EcAlerter.m: Add more debug logging to show what elarms/alerts are
+ handled by what rules.
+
2014-07-30 Richard Frith-Macdonald <[email protected]>
* EcProcess.h:
Modified: libs/ec/trunk/EcAlerter.m
URL:
http://svn.gna.org/viewcvs/gnustep/libs/ec/trunk/EcAlerter.m?rev=38055&r1=38054&r2=38055&view=diff
==============================================================================
--- libs/ec/trunk/EcAlerter.m (original)
+++ libs/ec/trunk/EcAlerter.m Tue Sep 2 11:19:29 2014
@@ -441,6 +441,7 @@
toEvent: (EcAlerterEvent*)event
{
CREATE_AUTORELEASE_POOL(pool);
+ BOOL found = NO;
NSUInteger i;
for (i = 0; i < [rulesArray count]; i++)
@@ -544,6 +545,13 @@
[event->m setObject: match forKey: @"Match"];
}
+
+ found = YES;
+ if (YES == debug)
+ {
+ NSLog(@"Rule %u matched %@ with %@", (unsigned)i, d, event->m);
+ }
+
/*
* If the Extra1 or Extra2 patterns are matched,
* The matching strings are made available for
@@ -799,6 +807,13 @@
if ([[d objectForKey: @"Stop"] boolValue] == YES)
{
break; // Don't want to perform any more matches.
+ }
+ }
+ if (NO == found)
+ {
+ if (YES == debug)
+ {
+ NSLog(@"No match of %@ with %@", event->m, rulesArray);
}
}
RELEASE(pool);
Modified: libs/ec/trunk/EcControl.m
URL:
http://svn.gna.org/viewcvs/gnustep/libs/ec/trunk/EcControl.m?rev=38055&r1=38054&r2=38055&view=diff
==============================================================================
--- libs/ec/trunk/EcControl.m (original)
+++ libs/ec/trunk/EcControl.m Tue Sep 2 11:19:29 2014
@@ -1829,7 +1829,7 @@
{
obj = old;
m = [NSString stringWithFormat:
- @"Re-registered new host with name '%@' at %@\n",
+ @"Re-registered existing host with name '%@' at %@\n",
n, [NSDate date]];
[self information: m
type: LT_AUDIT
@@ -1846,50 +1846,27 @@
with: self];
old = (CommandInfo*)[self findIn: commands byName: n];
- if (old != nil)
- {
- NS_DURING
- {
- [[old obj] cmdPing: self sequence: 0 extra: nil];
- }
- NS_HANDLER
- {
- NSLog(@"Ping %@ - Caught: %@", n, localException);
- }
- NS_ENDHANDLER
- }
-
- if ((old = (CommandInfo*)[self findIn: commands byName: n]) != nil)
- {
- RELEASE(obj);
- m = [NSString stringWithFormat:
- @"Rejected new host with name '%@' at %@\n",
- n, [NSDate date]];
- [self information: m
- type: LT_AUDIT
- to: nil
- from: nil];
- [dict setObject: @"client with that name already registered."
- forKey: @"rejected"];
- return [NSPropertyListSerialization
- dataFromPropertyList: dict
- format: NSPropertyListBinaryFormat_v1_0
- errorDescription: 0];
- }
+ [commands addObject: obj];
+ RELEASE(obj);
+ [commands sortUsingSelector: @selector(compare:)];
+ if (nil == old)
+ {
+ m = [NSString stringWithFormat:
+ @"Registered new host with name '%@' at %@\n",
+ n, [NSDate date]];
+ [self domanage: EcMakeManagedObject(n, @"Command", nil)];
+ }
else
- {
- [commands addObject: obj];
- RELEASE(obj);
- [commands sortUsingSelector: @selector(compare:)];
- [self domanage: EcMakeManagedObject(n, @"Command", nil)];
- m = [NSString stringWithFormat:
- @"Registered new host with name '%@' at %@\n",
- n, [NSDate date]];
- [self information: m
- type: LT_AUDIT
- to: nil
- from: nil];
- }
+ {
+ m = [NSString stringWithFormat:
+ @"Re-registered new host with name '%@' at %@\n",
+ n, [NSDate date]];
+ [commands removeObjectIdenticalTo: old];
+ }
+ [self information: m
+ type: LT_AUDIT
+ to: nil
+ from: nil];
}
/* Inform SNMP monitoring of new Command server.
_______________________________________________
Gnustep-cvs mailing list
[email protected]
https://mail.gna.org/listinfo/gnustep-cvs