Changeset 434

Show
Ignore:
Timestamp:
07/06/05 09:10:24 (8 years ago)
Author:
ahu
Message:

updates to the new TCP code - there was a bizarre typo which meant that it often would not work

Location:
trunk/pdns/pdns
Files:
2 modified

Legend:

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

    r433 r434  
    11/* 
    22    PowerDNS Versatile Database Driven Nameserver 
    3     Copyright (C) 2002 PowerDNS.COM BV 
     3    Copyright (C) 2002 - 2005 PowerDNS.COM BV 
    44 
    55    This program is free software; you can redistribute it and/or modify 
    6     it under the terms of the GNU General Public License as published by 
    7     the Free Software Foundation; either version 2 of the License, or 
    8     (at your option) any later version. 
     6    it under the terms of the GNU General Public License version 2 as  
     7    published by the Free Software Foundation 
    98 
    109    This program is distributed in the hope that it will be useful, 
     
    104103 
    105104    if(asendtcp(packet, &s) == 0) { 
    106       cerr<<"asendtcp: timeout"<<endl; 
    107       return -1; 
     105      //      cerr<<"asendtcp: timeout"<<endl; 
     106      return 0; 
    108107    } 
    109108     
    110109    packet.clear(); 
    111110    if(arecvtcp(packet,2, &s)==0) { 
    112       cerr<<"arecvtcp: timeout"<<endl; 
    113       return -1; 
     111      //      cerr<<"arecvtcp: timeout"<<endl; 
     112      return 0; 
    114113    } 
    115114 
     
    120119 
    121120    if(arecvtcp(packet, len, &s)==0) { 
    122       cerr<<"arecvtcp: timeout"<<endl; 
    123       return -1; 
     121      //      cerr<<"arecvtcp: timeout"<<endl; 
     122      return 0; 
    124123    } 
    125124 
     
    142141      throw LWResException("resolver: unable to parse packet of "+itoa(d_len)+" bytes"); 
    143142    d_aabit=p.d.aa; 
    144     d_aabit=p.d.tc; 
     143    d_tcbit=p.d.tc; 
    145144    d_rcode=p.d.rcode; 
    146145    return p.getAnswers(); 
  • trunk/pdns/pdns/syncres.cc

    r433 r434  
    412412 
    413413      result=d_lwr.result(); 
     414 
     415      if(d_lwr.d_tcbit) { 
     416        if(!doTCP) { 
     417          doTCP=true; 
     418          LOG<<prefix<<qname<<": truncated bit set, retrying via TCP"<<endl; 
     419          goto TryTCP; 
     420        } 
     421        LOG<<prefix<<qname<<": truncated bit set, over TCP?"<<endl; 
     422        return RCode::ServFail; 
     423      } 
     424 
    414425      if(d_lwr.d_rcode==RCode::ServFail) { 
    415426        LOG<<prefix<<qname<<": "<<*tns<<" returned a ServFail, trying sibling NS"<<endl; 
     
    537548      } 
    538549      if(nsset.empty() && !d_lwr.d_rcode) { 
    539         if(!negindic && d_lwr.d_tcbit) { 
    540           if(!doTCP) { 
    541             doTCP=true; 
    542             LOG<<prefix<<qname<<": status=noerror, truncated bit set, no negative SOA, retrying via TCP"<<endl; 
    543             goto TryTCP; 
    544           } 
    545           LOG<<prefix<<qname<<": status=noerror, truncated bit set, over TCP?"<<endl; 
    546           continue; 
    547         } 
     550 
    548551        LOG<<prefix<<qname<<": status=noerror, other types may exist, but we are done "<<(negindic ? "(have negative SOA)" : "")<<endl; 
    549552        return 0;