Chromium Code Reviews| Index: net/dns/dns_transaction.cc |
| diff --git a/net/dns/dns_transaction.cc b/net/dns/dns_transaction.cc |
| index 00d8064f6e8d6f263423659519e9691a99e406aa..a9390a2547dc0e8aaef8eec8bc1317d6214796aa 100644 |
| --- a/net/dns/dns_transaction.cc |
| +++ b/net/dns/dns_transaction.cc |
| @@ -71,6 +71,7 @@ class DnsUDPAttempt { |
| scoped_ptr<DnsQuery> query, |
| const CompletionCallback& callback) |
| : next_state_(STATE_NONE), |
| + received_malformed_response_(false), |
| socket_(socket.Pass()), |
| server_(server), |
| query_(query.Pass()), |
| @@ -150,8 +151,7 @@ class DnsUDPAttempt { |
| break; |
| } |
| } while (rv != ERR_IO_PENDING && next_state_ != STATE_NONE); |
| - |
| - return rv; |
| + return received_malformed_response_ ? ERR_DNS_MALFORMED_RESPONSE : rv; |
|
mmenke
2012/08/28 14:15:54
Err...How does this work? It looks like if we eve
szym
2012/08/28 14:59:44
You're right. This isn't finished yet, and the tes
|
| } |
| int DoConnect() { |
| @@ -196,12 +196,14 @@ class DnsUDPAttempt { |
| DCHECK(rv); |
| if (!response_->InitParse(rv, *query_)) { |
| - // TODO(szym): Consider making this reaction less aggressive. |
| // Other implementations simply ignore mismatched responses. Since each |
| // DnsUDPAttempt binds to a different port, we might find that responses |
| // to previously timed out queries lead to failures in the future. |
| - // http://crbug.com/107413 |
| - return ERR_DNS_MALFORMED_RESPONSE; |
| + // Our solution is to make another attempt, in case the query truly |
| + // failed, but keep this attempt alive, in case it was a false alarm. |
| + received_malformed_response_ = true; |
| + next_state_ = STATE_READ_RESPONSE; |
| + return ERR_IO_PENDING; |
| } |
| if (response_->flags() & dns_protocol::kFlagTC) |
| return ERR_DNS_SERVER_REQUIRES_TCP; |
| @@ -222,6 +224,7 @@ class DnsUDPAttempt { |
| } |
| State next_state_; |
| + bool received_malformed_response_; |
| scoped_ptr<DatagramClientSocket> socket_; |
| IPEndPoint server_; |