BLIP/BLIPReader.m
changeset 14 bb5faa9995d5
parent 8 6f539dd9921c
child 18 3be241de1630
     1.1 --- a/BLIP/BLIPReader.m	Thu May 29 16:40:36 2008 -0700
     1.2 +++ b/BLIP/BLIPReader.m	Wed Jun 04 21:09:45 2008 -0700
     1.3 @@ -31,27 +31,27 @@
     1.4  {
     1.5      self = [super initWithConnection: conn stream: stream];
     1.6      if (self != nil) {
     1.7 -        _pendingQueries = [[NSMutableDictionary alloc] init];
     1.8 -        _pendingReplies = [[NSMutableDictionary alloc] init];
     1.9 +        _pendingRequests = [[NSMutableDictionary alloc] init];
    1.10 +        _pendingResponses = [[NSMutableDictionary alloc] init];
    1.11      }
    1.12      return self;
    1.13  }
    1.14  
    1.15  - (void) dealloc
    1.16  {
    1.17 -    [_pendingQueries release];
    1.18 -    [_pendingReplies release];
    1.19 +    [_pendingRequests release];
    1.20 +    [_pendingResponses release];
    1.21      [_curBody release];
    1.22      [super dealloc];
    1.23  }
    1.24  
    1.25  - (void) disconnect
    1.26  {
    1.27 -    for( BLIPResponse *response in [_pendingReplies allValues] ) {
    1.28 +    for( BLIPResponse *response in [_pendingResponses allValues] ) {
    1.29          [response _connectionClosed];
    1.30          [_conn tellDelegate: @selector(connection:receivedResponse:) withObject: response];
    1.31      }
    1.32 -    setObj(&_pendingReplies,nil);
    1.33 +    setObj(&_pendingResponses,nil);
    1.34      [super disconnect];
    1.35  }
    1.36  
    1.37 @@ -154,7 +154,7 @@
    1.38  
    1.39  - (void) _addPendingResponse: (BLIPResponse*)response
    1.40  {
    1.41 -    [_pendingReplies setObject: response forKey: $object(response.number)];
    1.42 +    [_pendingResponses setObject: response forKey: $object(response.number)];
    1.43  }
    1.44  
    1.45  
    1.46 @@ -169,14 +169,14 @@
    1.47      switch(type) {
    1.48          case kBLIP_MSG: {
    1.49              // Incoming request:
    1.50 -            BLIPRequest *request = [_pendingQueries objectForKey: key];
    1.51 +            BLIPRequest *request = [_pendingRequests objectForKey: key];
    1.52              if( request ) {
    1.53                  // Continuation frame of a request:
    1.54                  if( complete ) {
    1.55                      [[request retain] autorelease];
    1.56 -                    [_pendingQueries removeObjectForKey: key];
    1.57 +                    [_pendingRequests removeObjectForKey: key];
    1.58                  }
    1.59 -            } else if( header->number == _numQueriesReceived+1 ) {
    1.60 +            } else if( header->number == _numRequestsReceived+1 ) {
    1.61                  // Next new request:
    1.62                  request = [[[BLIPRequest alloc] _initWithConnection: _blipConn
    1.63                                                           isMine: NO
    1.64 @@ -185,12 +185,12 @@
    1.65                                                             body: nil]
    1.66                                  autorelease];
    1.67                  if( ! complete )
    1.68 -                    [_pendingQueries setObject: request forKey: key];
    1.69 -                _numQueriesReceived++;
    1.70 +                    [_pendingRequests setObject: request forKey: key];
    1.71 +                _numRequestsReceived++;
    1.72              } else
    1.73                  return [self _gotError: BLIPMakeError(kBLIPError_BadFrame, 
    1.74                                                 @"Received bad request frame #%u (next is #%u)",
    1.75 -                                               header->number,_numQueriesReceived+1)];
    1.76 +                                               header->number,_numRequestsReceived+1)];
    1.77              
    1.78              if( ! [request _receivedFrameWithHeader: header body: body] )
    1.79                  return [self _gotError: BLIPMakeError(kBLIPError_BadFrame, 
    1.80 @@ -203,11 +203,11 @@
    1.81              
    1.82          case kBLIP_RPY:
    1.83          case kBLIP_ERR: {
    1.84 -            BLIPResponse *response = [_pendingReplies objectForKey: key];
    1.85 +            BLIPResponse *response = [_pendingResponses objectForKey: key];
    1.86              if( response ) {
    1.87                  if( complete ) {
    1.88                      [[response retain] autorelease];
    1.89 -                    [_pendingReplies removeObjectForKey: key];
    1.90 +                    [_pendingResponses removeObjectForKey: key];
    1.91                  }
    1.92                  
    1.93                  if( ! [response _receivedFrameWithHeader: header body: body] ) {
    1.94 @@ -217,7 +217,7 @@
    1.95                      [_blipConn _dispatchResponse: response];
    1.96                  
    1.97              } else {
    1.98 -                if( header->number <= ((BLIPWriter*)self.writer).numQueriesSent )
    1.99 +                if( header->number <= ((BLIPWriter*)self.writer).numRequestsSent )
   1.100                      LogTo(BLIP,@"??? %@ got unexpected response frame to my msg #%u",
   1.101                            self,header->number); //benign
   1.102                  else