Eradicate all uses of std::bind()
Change-Id: I6e1ccf2d87b76142e6d519c1a288d03022e4d167
diff --git a/tools/ping/server/ping-server.cpp b/tools/ping/server/ping-server.cpp
index ad8177c..5ceeb76 100644
--- a/tools/ping/server/ping-server.cpp
+++ b/tools/ping/server/ping-server.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2015-2019, Arizona Board of Regents.
+ * Copyright (c) 2015-2021, Arizona Board of Regents.
*
* This file is part of ndn-tools (Named Data Networking Essential Tools).
* See AUTHORS.md for complete list of ndn-tools authors and contributors.
@@ -42,12 +42,11 @@
void
PingServer::start()
{
- m_registeredPrefix = m_face.setInterestFilter(
- Name(m_options.prefix).append("ping"),
- bind(&PingServer::onInterest, this, _2),
- [] (const auto&, const auto& reason) {
- NDN_THROW(std::runtime_error("Failed to register prefix: " + reason));
- });
+ m_registeredPrefix = m_face.setInterestFilter(Name(m_options.prefix).append("ping"),
+ [this] (const auto&, const auto& interest) { onInterest(interest); },
+ [] (const auto&, const auto& reason) {
+ NDN_THROW(std::runtime_error("Failed to register prefix: " + reason));
+ });
}
void
diff --git a/tools/ping/server/tracer.cpp b/tools/ping/server/tracer.cpp
index 51b191c..c6b30b9 100644
--- a/tools/ping/server/tracer.cpp
+++ b/tools/ping/server/tracer.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2015-2018, Arizona Board of Regents.
+ * Copyright (c) 2015-2021, Arizona Board of Regents.
*
* This file is part of ndn-tools (Named Data Networking Essential Tools).
* See AUTHORS.md for complete list of ndn-tools authors and contributors.
@@ -29,20 +29,15 @@
: m_options(options)
{
if (!m_options.wantQuiet) {
- pingServer.afterReceive.connect([this] (const Name& name) { onReceive(name); });
+ pingServer.afterReceive.connect([this] (const Name& name) {
+ if (m_options.wantTimestamp) {
+ std::cout << time::toIsoString(time::system_clock::now()) << " - ";
+ }
+ std::cout << "interest received: seq=" << name.at(-1) << "\n";
+ });
}
}
-void
-Tracer::onReceive(const Name& name)
-{
- if (m_options.wantTimestamp) {
- std::cout << time::toIsoString(time::system_clock::now()) << " - ";
- }
-
- std::cout << "interest received: seq=" << name.at(-1) << std::endl;
-}
-
} // namespace server
} // namespace ping
} // namespace ndn
diff --git a/tools/ping/server/tracer.hpp b/tools/ping/server/tracer.hpp
index b8b6952..a84b72e 100644
--- a/tools/ping/server/tracer.hpp
+++ b/tools/ping/server/tracer.hpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
- * Copyright (c) 2015, Arizona Board of Regents.
+/*
+ * Copyright (c) 2015-2021, Arizona Board of Regents.
*
* This file is part of ndn-tools (Named Data Networking Essential Tools).
* See AUTHORS.md for complete list of ndn-tools authors and contributors.
@@ -31,20 +31,13 @@
namespace server {
/**
- * @brief logs ping responses
+ * @brief Logs ping responses
*/
class Tracer : noncopyable
{
public:
Tracer(PingServer& pingServer, const Options& options);
- /**
- * @brief Prints ping information when interest received
- * @param name interest name received
- */
- void
- onReceive(const Name& name);
-
private:
const Options& m_options;
};