Improve and simplify code with modern C++ features
Change-Id: I83bf5513c2a1f90ba5a59e93c473306864b27d94
diff --git a/daemon/face/ethernet-channel.cpp b/daemon/face/ethernet-channel.cpp
index 3791d44..69c6f45 100644
--- a/daemon/face/ethernet-channel.cpp
+++ b/daemon/face/ethernet-channel.cpp
@@ -65,7 +65,7 @@
catch (const boost::system::system_error& e) {
NFD_LOG_CHAN_DEBUG("Face creation for " << remoteEndpoint << " failed: " << e.what());
if (onConnectFailed)
- onConnectFailed(504, std::string("Face creation failed: ") + e.what());
+ onConnectFailed(504, "Face creation failed: "s + e.what());
return;
}
@@ -102,9 +102,7 @@
const FaceCreationFailedCallback& onReceiveFailed)
{
m_socket.async_read_some(boost::asio::null_buffers(),
- bind(&EthernetChannel::handleRead, this,
- boost::asio::placeholders::error,
- onFaceCreated, onReceiveFailed));
+ [=] (const auto& e, auto) { this->handleRead(e, onFaceCreated, onReceiveFailed); });
}
void
@@ -172,7 +170,7 @@
catch (const EthernetTransport::Error& e) {
NFD_LOG_CHAN_DEBUG("Face creation for " << sender << " failed: " << e.what());
if (onReceiveFailed)
- onReceiveFailed(504, std::string("Face creation failed: ") + e.what());
+ onReceiveFailed(504, "Face creation failed: "s + e.what());
return;
}