simplify -description methods and improve warning logs

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@28622 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Richard Frith-MacDonald 2009-09-07 13:49:48 +00:00
parent 826cd93801
commit 14a28f5b7c
3 changed files with 16 additions and 21 deletions

View file

@ -2936,6 +2936,8 @@ static void callEncoder (DOContext *ctxt)
NS_DURING
{
BOOL warned = NO;
if (debug_connection > 5)
NSLog(@"Waiting for reply sequence %d on %@",
sn, self);
@ -2985,21 +2987,20 @@ static void callEncoder (DOContext *ctxt)
* were waiting for the final timeout, then we must break out
* of the loop.
*/
if ([runLoop runMode: NSConnectionReplyMode
if (([runLoop runMode: NSConnectionReplyMode
beforeDate: limit_date] == NO
&& (limit_date == timeout_date))
|| [timeout_date timeIntervalSinceNow] <= 0.0)
{
if (limit_date == timeout_date)
{
M_LOCK(_queueGate); isLocked = YES;
node = GSIMapNodeForKey(_replyMap, (GSIMapKey)sn);
break;
}
else if (_multipleThreads == NO)
{
NSLog(@"WARNING ... waiting for reply %u since %@ on %@",
sn, start_date, self);
}
M_LOCK(_queueGate); isLocked = YES;
node = GSIMapNodeForKey(_replyMap, (GSIMapKey)sn);
break;
}
else if (warned == NO && [start_date timeIntervalSinceNow] <= -300.0)
{
warned = YES;
NSLog(@"WARNING ... waiting for reply %u since %@ on %@",
sn, start_date, self);
}
M_LOCK(_queueGate); isLocked = YES;
}

View file

@ -1335,13 +1335,10 @@ typedef struct {
- (NSString*) description
{
NSString *desc;
NSArray *names;
names = [[NSMessagePortNameServer sharedInstance] namesForPort: self];
desc = [NSString stringWithFormat:
@"<%s %p %@ with file name %s>",
GSClassNameFromObject(self), self,
([names count] == 0) ? (id)@"<un-named>" : (id)names, [name bytes]];
@"<%s %p file name %s>",
GSClassNameFromObject(self), self, [name bytes]];
return desc;
}

View file

@ -1803,13 +1803,10 @@ static Class tcpPortClass;
- (NSString*) description
{
NSString *desc;
NSArray *names;
names = [[NSSocketPortNameServer sharedInstance] namesForPort: self];
desc = [NSString stringWithFormat:
@"<%s %p %@ on IP %@,%d>",
@"<%s %p on IP %@,%d>",
GSClassNameFromObject(self), self,
(([names count] == 0) ? (id)@"(<un-named>)" : (id)names), host,
((address == nil) ? (id)@"any" : (id)address), portNum];
return desc;
}