mirror of
https://github.com/gnustep/libs-ec.git
synced 2025-02-21 02:41:11 +00:00
ireliability and debug tweaks
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/ec/trunk@38055 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
4573054ca2
commit
b4874b21ba
3 changed files with 46 additions and 44 deletions
10
ChangeLog
10
ChangeLog
|
@ -1,3 +1,13 @@
|
||||||
|
2014-09-02 Richard Frith-Macdonald <rfm@gnu.org>
|
||||||
|
|
||||||
|
* 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 <rfm@gnu.org>
|
2014-07-30 Richard Frith-Macdonald <rfm@gnu.org>
|
||||||
|
|
||||||
* EcProcess.h:
|
* EcProcess.h:
|
||||||
|
|
15
EcAlerter.m
15
EcAlerter.m
|
@ -441,6 +441,7 @@ replaceFields(NSDictionary *fields, NSString *template)
|
||||||
toEvent: (EcAlerterEvent*)event
|
toEvent: (EcAlerterEvent*)event
|
||||||
{
|
{
|
||||||
CREATE_AUTORELEASE_POOL(pool);
|
CREATE_AUTORELEASE_POOL(pool);
|
||||||
|
BOOL found = NO;
|
||||||
NSUInteger i;
|
NSUInteger i;
|
||||||
|
|
||||||
for (i = 0; i < [rulesArray count]; i++)
|
for (i = 0; i < [rulesArray count]; i++)
|
||||||
|
@ -544,6 +545,13 @@ replaceFields(NSDictionary *fields, NSString *template)
|
||||||
[event->m setObject: match forKey: @"Match"];
|
[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,
|
* If the Extra1 or Extra2 patterns are matched,
|
||||||
* The matching strings are made available for
|
* The matching strings are made available for
|
||||||
|
@ -801,6 +809,13 @@ replaceFields(NSDictionary *fields, NSString *template)
|
||||||
break; // Don't want to perform any more matches.
|
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);
|
RELEASE(pool);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
47
EcControl.m
47
EcControl.m
|
@ -1829,7 +1829,7 @@ static NSString* cmdWord(NSArray* a, unsigned int pos)
|
||||||
{
|
{
|
||||||
obj = old;
|
obj = old;
|
||||||
m = [NSString stringWithFormat:
|
m = [NSString stringWithFormat:
|
||||||
@"Re-registered new host with name '%@' at %@\n",
|
@"Re-registered existing host with name '%@' at %@\n",
|
||||||
n, [NSDate date]];
|
n, [NSDate date]];
|
||||||
[self information: m
|
[self information: m
|
||||||
type: LT_AUDIT
|
type: LT_AUDIT
|
||||||
|
@ -1846,51 +1846,28 @@ static NSString* cmdWord(NSArray* a, unsigned int pos)
|
||||||
with: self];
|
with: self];
|
||||||
|
|
||||||
old = (CommandInfo*)[self findIn: commands byName: n];
|
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];
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
[commands addObject: obj];
|
[commands addObject: obj];
|
||||||
RELEASE(obj);
|
RELEASE(obj);
|
||||||
[commands sortUsingSelector: @selector(compare:)];
|
[commands sortUsingSelector: @selector(compare:)];
|
||||||
[self domanage: EcMakeManagedObject(n, @"Command", nil)];
|
if (nil == old)
|
||||||
|
{
|
||||||
m = [NSString stringWithFormat:
|
m = [NSString stringWithFormat:
|
||||||
@"Registered new host with name '%@' at %@\n",
|
@"Registered new host with name '%@' at %@\n",
|
||||||
n, [NSDate date]];
|
n, [NSDate date]];
|
||||||
|
[self domanage: EcMakeManagedObject(n, @"Command", nil)];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m = [NSString stringWithFormat:
|
||||||
|
@"Re-registered new host with name '%@' at %@\n",
|
||||||
|
n, [NSDate date]];
|
||||||
|
[commands removeObjectIdenticalTo: old];
|
||||||
|
}
|
||||||
[self information: m
|
[self information: m
|
||||||
type: LT_AUDIT
|
type: LT_AUDIT
|
||||||
to: nil
|
to: nil
|
||||||
from: nil];
|
from: nil];
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/* Inform SNMP monitoring of new Command server.
|
/* Inform SNMP monitoring of new Command server.
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Reference in a new issue