OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include <stdio.h> | 5 #include <stdio.h> |
6 #include <string> | 6 #include <string> |
7 | 7 |
8 #include "base/at_exit.h" | 8 #include "base/at_exit.h" |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/cancelable_callback.h" | 10 #include "base/cancelable_callback.h" |
(...skipping 469 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
480 DCHECK_LT(entry_index, replay_log_.size()); | 480 DCHECK_LT(entry_index, replay_log_.size()); |
481 --active_resolves_; | 481 --active_resolves_; |
482 base::TimeDelta resolve_end_time = base::Time::Now() - start_time_; | 482 base::TimeDelta resolve_end_time = base::Time::Now() - start_time_; |
483 base::TimeDelta resolve_time = resolve_end_time - resolve_start_time; | 483 base::TimeDelta resolve_time = resolve_end_time - resolve_start_time; |
484 printf("%u %d %d %s %d ", | 484 printf("%u %d %d %s %d ", |
485 entry_index, | 485 entry_index, |
486 static_cast<int>(resolve_end_time.InMilliseconds()), | 486 static_cast<int>(resolve_end_time.InMilliseconds()), |
487 static_cast<int>(resolve_time.InMilliseconds()), | 487 static_cast<int>(resolve_time.InMilliseconds()), |
488 replay_log_[entry_index].domain_name.c_str(), val); | 488 replay_log_[entry_index].domain_name.c_str(), val); |
489 if (val != OK) { | 489 if (val != OK) { |
490 printf("%s", ErrorToString(val)); | 490 std::string error_string = ErrorToString(val); |
| 491 printf("%s", error_string.c_str()); |
491 } else { | 492 } else { |
492 for (size_t i = 0; i < address_list->size(); ++i) { | 493 for (size_t i = 0; i < address_list->size(); ++i) { |
493 if (i != 0) | 494 if (i != 0) |
494 printf(" "); | 495 printf(" "); |
495 printf("%s", (*address_list)[i].ToStringWithoutPort().c_str()); | 496 printf("%s", (*address_list)[i].ToStringWithoutPort().c_str()); |
496 } | 497 } |
497 } | 498 } |
498 printf("\n"); | 499 printf("\n"); |
499 if (active_resolves_ == 0 && replay_log_index_ >= replay_log_.size()) | 500 if (active_resolves_ == 0 && replay_log_index_ >= replay_log_.size()) |
500 Finish(RESULT_OK); | 501 Finish(RESULT_OK); |
501 } | 502 } |
502 | 503 |
503 void GDig::OnTimeout() { | 504 void GDig::OnTimeout() { |
504 fprintf(stderr, "Timed out waiting to load the dns config\n"); | 505 fprintf(stderr, "Timed out waiting to load the dns config\n"); |
505 Finish(RESULT_NO_CONFIG); | 506 Finish(RESULT_NO_CONFIG); |
506 } | 507 } |
507 | 508 |
508 } // empty namespace | 509 } // empty namespace |
509 | 510 |
510 } // namespace net | 511 } // namespace net |
511 | 512 |
512 int main(int argc, const char* argv[]) { | 513 int main(int argc, const char* argv[]) { |
513 net::GDig dig; | 514 net::GDig dig; |
514 return dig.Main(argc, argv); | 515 return dig.Main(argc, argv); |
515 } | 516 } |
OLD | NEW |