faces: Channel base class
refs #1261
Change-Id: If17037c4802cb6ccec0201c3bff7fc4b6db41c6a
diff --git a/daemon/face/unix-stream-channel.cpp b/daemon/face/unix-stream-channel.cpp
index ebc7e77..1a92f73 100644
--- a/daemon/face/unix-stream-channel.cpp
+++ b/daemon/face/unix-stream-channel.cpp
@@ -5,6 +5,7 @@
*/
#include "unix-stream-channel.hpp"
+#include "core/global-io.hpp"
#include <boost/filesystem.hpp>
#include <sys/stat.h> // for chmod()
@@ -15,11 +16,10 @@
using namespace boost::asio::local;
-UnixStreamChannel::UnixStreamChannel(boost::asio::io_service& ioService,
- const unix_stream::Endpoint& endpoint)
- : m_ioService(ioService)
- , m_endpoint(endpoint)
+UnixStreamChannel::UnixStreamChannel(const unix_stream::Endpoint& endpoint)
+ : m_endpoint(endpoint)
{
+ this->setUri(FaceUri(endpoint));
}
UnixStreamChannel::~UnixStreamChannel()
@@ -50,7 +50,7 @@
fs::remove(p);
}
- m_acceptor = make_shared<stream_protocol::acceptor>(boost::ref(m_ioService));
+ m_acceptor = make_shared<stream_protocol::acceptor>(boost::ref(getGlobalIoService()));
m_acceptor->open(m_endpoint.protocol());
m_acceptor->bind(m_endpoint);
m_acceptor->listen(backlog);
@@ -61,7 +61,7 @@
}
shared_ptr<stream_protocol::socket> clientSocket =
- make_shared<stream_protocol::socket>(boost::ref(m_ioService));
+ make_shared<stream_protocol::socket>(boost::ref(getGlobalIoService()));
m_acceptor->async_accept(*clientSocket,
bind(&UnixStreamChannel::handleSuccessfulAccept, this, _1,
clientSocket, onFaceCreated, onAcceptFailed));
@@ -95,7 +95,7 @@
// prepare accepting the next connection
shared_ptr<stream_protocol::socket> clientSocket =
- make_shared<stream_protocol::socket>(boost::ref(m_ioService));
+ make_shared<stream_protocol::socket>(boost::ref(getGlobalIoService()));
m_acceptor->async_accept(*clientSocket,
bind(&UnixStreamChannel::handleSuccessfulAccept, this, _1,
clientSocket, onFaceCreated, onAcceptFailed));