face: Don't crash when attempting to create UdpFace over a half-working connection

Change-Id: Ib32128074f8dfe834fde033517325f994d648767
Refs: #2311
diff --git a/daemon/face/udp-channel.cpp b/daemon/face/udp-channel.cpp
index c4bb0e8..2ab4b77 100644
--- a/daemon/face/udp-channel.cpp
+++ b/daemon/face/udp-channel.cpp
@@ -229,7 +229,13 @@
     clientSocket->open(m_localEndpoint.protocol());
     clientSocket->set_option(ip::udp::socket::reuse_address(true));
     clientSocket->bind(m_localEndpoint);
-    clientSocket->connect(m_newRemoteEndpoint);
+    boost::system::error_code ec;
+    clientSocket->connect(m_newRemoteEndpoint, ec);
+    if (ec) {
+      NFD_LOG_WARN("Error while creating on-demand UDP face from " << m_newRemoteEndpoint << ": "
+                   << boost::system::system_error(ec).what());
+      return;
+    }
 
     face = createFace(clientSocket,
                       onFaceCreatedNewPeerCallback,