Add some debug

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@27152 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
rfm 2008-11-27 15:01:19 +00:00
parent e95b7438e7
commit ee79d65b5b

View file

@ -39,6 +39,7 @@
#define NSIG 32 #define NSIG 32
#endif #endif
static BOOL debugging = NO;
static BOOL is_daemon = NO; /* Currently running as daemon. */ static BOOL is_daemon = NO; /* Currently running as daemon. */
static BOOL auto_stop = NO; /* Should we shut down when unused? */ static BOOL auto_stop = NO; /* Should we shut down when unused? */
static char ebuf[2048]; static char ebuf[2048];
@ -197,6 +198,11 @@ ihandler(int sig)
RELEASE(info); RELEASE(info);
[super dealloc]; [super dealloc];
} }
- (NSString*) description
{
return [NSString stringWithFormat: @"%@ Name:'%@' Object:'%@' Info:'%@'",
[super description], name, object, info];
}
+ (GDNCNotification*) notificationWithName: (NSString*)notificationName + (GDNCNotification*) notificationWithName: (NSString*)notificationName
object: (NSString*)notificationObject object: (NSString*)notificationObject
data: (NSData*)notificationData data: (NSData*)notificationData
@ -524,6 +530,10 @@ ihandler(int sig)
GDNCObserver *obs; GDNCObserver *obs;
NSConnection *connection; NSConnection *connection;
if (debugging)
NSLog(@"Adding observer %lu for %@ %@",
anObserver, notificationName, anObject);
connection = [(NSDistantObject*)client connectionForProxy]; connection = [(NSDistantObject*)client connectionForProxy];
clients = (NSMapTable*)NSMapGet(connections, connection); clients = (NSMapTable*)NSMapGet(connections, connection);
if (clients == 0) if (clients == 0)
@ -803,6 +813,8 @@ ihandler(int sig)
NS_DURING NS_DURING
{ {
[obs->queue removeObjectAtIndex: 0]; [obs->queue removeObjectAtIndex: 0];
if (debugging)
NSLog(@"Posting to observer %lu with %@", obs->observer, n);
[obs->client->client postNotificationName: n->name [obs->client->client postNotificationName: n->name
object: n->object object: n->object
userInfo: n->info userInfo: n->info
@ -822,6 +834,11 @@ ihandler(int sig)
- (void) removeObserver: (GDNCObserver*)observer - (void) removeObserver: (GDNCObserver*)observer
{ {
if (debugging)
NSLog(@"Removing observer %lu for %@ %@",
observer->observer, observer->notificationName,
observer->notificationObject);
if (observer->notificationObject) if (observer->notificationObject)
{ {
NSMutableArray *objList; NSMutableArray *objList;
@ -1048,7 +1065,6 @@ main(int argc, char** argv, char** env)
{ {
GDNCServer *server; GDNCServer *server;
BOOL subtask = YES; BOOL subtask = YES;
BOOL debugging = NO;
NSProcessInfo *pInfo; NSProcessInfo *pInfo;
NSMutableArray *args; NSMutableArray *args;
CREATE_AUTORELEASE_POOL(pool); CREATE_AUTORELEASE_POOL(pool);