tools: fix the inconsistent logging among ndn-autoconfig stages
refs #4079
Change-Id: Ie1edd8d30dbe7a9f5bf7b3364a07e71910cd91eb
diff --git a/tools/ndn-autoconfig/guess-from-identity-name.cpp b/tools/ndn-autoconfig/guess-from-identity-name.cpp
index 5a6df3e..b9700aa 100644
--- a/tools/ndn-autoconfig/guess-from-identity-name.cpp
+++ b/tools/ndn-autoconfig/guess-from-identity-name.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/**
- * Copyright (c) 2014-2015, Regents of the University of California,
+ * Copyright (c) 2014-2017, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -38,7 +38,7 @@
void
GuessFromIdentityName::start()
{
- std::cerr << "Trying to find home router based on the default identity name..." << std::endl;
+ std::cerr << "Trying default identity name..." << std::endl;
Name identity = m_keyChain.getDefaultIdentity();
diff --git a/tools/ndn-autoconfig/guess-from-search-domains.cpp b/tools/ndn-autoconfig/guess-from-search-domains.cpp
index 2f452e7..ae38cad 100644
--- a/tools/ndn-autoconfig/guess-from-search-domains.cpp
+++ b/tools/ndn-autoconfig/guess-from-search-domains.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/**
- * Copyright (c) 2014-2015, Regents of the University of California,
+ * Copyright (c) 2014-2017, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -38,6 +38,8 @@
void
GuessFromSearchDomains::start()
{
+ std::cerr << "Trying default suffix DNS query..." << std::endl;
+
try {
std::string hubUri = BaseDns::querySrvRrSearch();
this->connectToHub(hubUri);
diff --git a/tools/ndn-autoconfig/ndn-fch-discovery.cpp b/tools/ndn-autoconfig/ndn-fch-discovery.cpp
index 56b7fd1..13dd3ab 100644
--- a/tools/ndn-autoconfig/ndn-fch-discovery.cpp
+++ b/tools/ndn-autoconfig/ndn-fch-discovery.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/**
- * Copyright (c) 2014-2016, Regents of the University of California,
+ * Copyright (c) 2014-2017, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -143,6 +143,8 @@
void
NdnFchDiscovery::start()
{
+ std::cerr << "Trying NDN-FCH service..." << std::endl;
+
try {
using namespace boost::asio::ip;
tcp::iostream requestStream;
@@ -186,12 +188,11 @@
std::getline(responseStream, statusMessage);
if (!static_cast<bool>(requestStream) || httpVersion.substr(0, 5) != "HTTP/") {
- throw HttpException("HTTP communication error");
+ BOOST_THROW_EXCEPTION(HttpException("HTTP communication error"));
}
if (statusCode != 200) {
boost::trim(statusMessage);
- throw HttpException("HTTP request failed: " +
- std::to_string(statusCode) + " " + statusMessage);
+ BOOST_THROW_EXCEPTION(HttpException("HTTP request failed: " + std::to_string(statusCode) + " " + statusMessage));
}
std::string header;
while (std::getline(requestStream, header) && header != "\r")
@@ -201,7 +202,7 @@
requestStream >> hubHost;
if (hubHost.empty()) {
- throw HttpException("NDN-FCH did not return hub host");
+ BOOST_THROW_EXCEPTION(HttpException("NDN-FCH did not return hub host"));
}
this->connectToHub("udp://" + hubHost);