face: Adding new 'createFace' method in all Factories
This method accepts parsed URI object and attempts to create Face on the
right channel (e.g., if hostname in URI resolved to IPv6, IPv6 TCP channel
will be used).
Factories that do not support 'createFace' operation will throw an exception.
As of this commit, *Factory::create methods are renamed to more explicit
*Factory::createChannel, and *Factory::connect to *Factory::createFace.
All other Factory-specific methods should denote what exactly is
created: channel, face, or multicast face.
Change-Id: I6396dc84c4cd8bbcdde9f55cfac90635d99e93e9
Refs: #1195
diff --git a/daemon/face/unix-stream-factory.cpp b/daemon/face/unix-stream-factory.cpp
index 070d8c1..20c01d9 100644
--- a/daemon/face/unix-stream-factory.cpp
+++ b/daemon/face/unix-stream-factory.cpp
@@ -12,13 +12,13 @@
namespace nfd {
shared_ptr<UnixStreamChannel>
-UnixStreamFactory::create(const std::string& unixSocketPath)
+UnixStreamFactory::createChannel(const std::string& unixSocketPath)
{
boost::filesystem::path p(unixSocketPath);
p = boost::filesystem::canonical(p.parent_path()) / p.filename();
unix_stream::Endpoint endpoint(p.string());
- shared_ptr<UnixStreamChannel> channel = find(endpoint);
+ shared_ptr<UnixStreamChannel> channel = findChannel(endpoint);
if (channel)
return channel;
@@ -29,7 +29,7 @@
}
shared_ptr<UnixStreamChannel>
-UnixStreamFactory::find(const unix_stream::Endpoint& endpoint)
+UnixStreamFactory::findChannel(const unix_stream::Endpoint& endpoint)
{
ChannelMap::iterator i = m_channels.find(endpoint);
if (i != m_channels.end())
@@ -38,4 +38,12 @@
return shared_ptr<UnixStreamChannel>();
}
+void
+UnixStreamFactory::createFace(const FaceUri& uri,
+ const FaceCreatedCallback& onCreated,
+ const FaceConnectFailedCallback& onConnectFailed)
+{
+ throw Error("UnixStreamFactory does not support 'createFace' operation");
+}
+
} // namespace nfd