mirror of
https://github.com/gnustep/libs-ec.git
synced 2025-02-16 00:21:01 +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>
|
||||
|
||||
* EcProcess.h:
|
||||
|
|
15
EcAlerter.m
15
EcAlerter.m
|
@ -441,6 +441,7 @@ replaceFields(NSDictionary *fields, NSString *template)
|
|||
toEvent: (EcAlerterEvent*)event
|
||||
{
|
||||
CREATE_AUTORELEASE_POOL(pool);
|
||||
BOOL found = NO;
|
||||
NSUInteger i;
|
||||
|
||||
for (i = 0; i < [rulesArray count]; i++)
|
||||
|
@ -544,6 +545,13 @@ replaceFields(NSDictionary *fields, NSString *template)
|
|||
[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
|
||||
|
@ -801,6 +809,13 @@ replaceFields(NSDictionary *fields, NSString *template)
|
|||
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);
|
||||
}
|
||||
|
||||
|
|
65
EcControl.m
65
EcControl.m
|
@ -1829,7 +1829,7 @@ static NSString* cmdWord(NSArray* a, unsigned int pos)
|
|||
{
|
||||
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 @@ static NSString* cmdWord(NSArray* a, unsigned int pos)
|
|||
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.
|
||||
|
|
Loading…
Reference in a new issue