Show
Ignore:
Timestamp:
05/24/06 00:41:04 (7 years ago)
Author:
ahu
Message:

make query chaining select on type as well..

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/pdns/pdns/pdns_recursor.cc

    r838 r843  
    284284/* these two functions are used by LWRes */ 
    285285// -2 is OS error, -1 is error that depends on the remote, > 0 is success 
    286 int asendto(const char *data, int len, int flags, const ComboAddress& toaddr, uint16_t id, const string& domain, int* fd)  
     286int asendto(const char *data, int len, int flags,  
     287            const ComboAddress& toaddr, uint16_t id, const string& domain, uint16_t qtype, int* fd)  
    287288{ 
    288289 
    289290  PacketID pident; 
    290   pident.domain=domain; 
    291   pident.remote=toaddr; 
     291  pident.domain = domain; 
     292  pident.remote = toaddr; 
     293  pident.type = qtype; 
    292294 
    293295  // see if there is an existing outstanding request we can chain on to, using partial equivalence function 
     
    325327 
    326328// -1 is error, 0 is timeout, 1 is success 
    327 int arecvfrom(char *data, int len, int flags, const ComboAddress& fromaddr, int *d_len, uint16_t id, const string& domain, int fd) 
     329int arecvfrom(char *data, int len, int flags, const ComboAddress& fromaddr, int *d_len,  
     330              uint16_t id, const string& domain, uint16_t qtype, int fd) 
    328331{ 
    329332  static optional<unsigned int> nearMissLimit; 
     
    335338  pident.id=id; 
    336339  pident.domain=domain; 
     340  pident.type = qtype; 
    337341  pident.remote=fromaddr; 
    338342 
     
    993997; 
    994998 
    995 string questionExpand(const char* packet, uint16_t len) 
    996 { 
     999string questionExpand(const char* packet, uint16_t len, uint16_t& type) 
     1000{ 
     1001  type=0; 
    9971002  const char* end=packet+len; 
    9981003  const char* pos=packet+12; 
     
    10091014  if(ret.empty()) 
    10101015    ret="."; 
     1016 
     1017  if(pos + labellen + 2 <= end)  // is this correct XXX FIXME? 
     1018    type=(*pos)*256 + *(pos+1); 
     1019     
    10111020  return ret; 
    10121021} 
     
    11411150    pident.id=dh.id; 
    11421151    pident.fd=fd; 
    1143     pident.domain=questionExpand(data, len); // don't copy this from above - we need to do the actual read 
     1152    pident.domain=questionExpand(data, len, pident.type); // don't copy this from above - we need to do the actual read 
    11441153    string packet; 
    11451154    packet.assign(data, len); 
     
    11561165       
    11571166      for(MT_t::waiters_t::iterator mthread=MT->d_waiters.begin(); mthread!=MT->d_waiters.end(); ++mthread) { 
    1158         if(pident.fd==mthread->key.fd && mthread->key.remote==pident.remote &&  
     1167        if(pident.fd==mthread->key.fd && mthread->key.remote==pident.remote &&  mthread->key.type == pident.type && 
    11591168           !Utility::strcasecmp(pident.domain.c_str(), mthread->key.domain.c_str())) { 
    11601169          mthread->key.nearMisses++;