diff -r 6f539dd9921c -r 29e8b03c05d4 BLIP/BLIPTest.m --- a/BLIP/BLIPTest.m Thu May 29 16:40:36 2008 -0700 +++ b/BLIP/BLIPTest.m Tue Jun 03 16:56:33 2008 -0700 @@ -25,6 +25,7 @@ #endif +#define kListenerHost @"localhost" #define kListenerPort 46353 #define kSendInterval 0.5 #define kNBatchedMessages 20 @@ -66,7 +67,7 @@ if (self != nil) { Log(@"** INIT %@",self); _pending = [[NSMutableDictionary alloc] init]; - IPAddress *addr = [[IPAddress alloc] initWithHostname: @"localhost" port: kListenerPort]; + IPAddress *addr = [[IPAddress alloc] initWithHostname: kListenerHost port: kListenerPort]; _conn = [[BLIPConnection alloc] initToAddress: addr]; if( ! _conn ) { [self release]; @@ -99,30 +100,34 @@ - (void) sendAMessage { - Log(@"** Sending another %i messages...", kNBatchedMessages); - for( int i=0; i 12 ) - q.urgent = YES; - BLIPResponse *response = [q send]; - Assert(response); - Assert(q.number>0); - Assert(response.number==q.number); - [_pending setObject: $object(size) forKey: $object(q.number)]; - response.onComplete = $target(self,responseArrived:); + if(_pending.count<100) { + Log(@"** Sending another %i messages...", kNBatchedMessages); + for( int i=0; i 12 ) + q.urgent = YES; + BLIPResponse *response = [q send]; + Assert(response); + Assert(q.number>0); + Assert(response.number==q.number); + [_pending setObject: $object(size) forKey: $object(q.number)]; + response.onComplete = $target(self,responseArrived:); + } + } else { + Warn(@"There are %u pending messages; waiting for the listener to catch up...",_pending.count); } [self performSelector: @selector(sendAMessage) withObject: nil afterDelay: kSendInterval]; } @@ -184,7 +189,6 @@ Assert(sizeObj); [_pending removeObjectForKey: $object(response.number)]; Log(@"Now %u replies pending", _pending.count); - Assert(_pending.count<100); }