face: Extending Face interface to support ``put`` call
Also, this commit includes Face/Node/Transport enhancement in regard to
the error processing: io_service thread will be stopped and Node::Error
exception will be thrown)
Change-Id: Ibec2f75e7b7d2e9a221a857fdc63295dd7da16e0
diff --git a/src/transport/unix-transport.cpp b/src/transport/unix-transport.cpp
index 3e01943..4bf85d7 100644
--- a/src/transport/unix-transport.cpp
+++ b/src/transport/unix-transport.cpp
@@ -74,6 +74,12 @@
{
/// @todo The socket is not datagram, so need to have internal buffer to handle partial data reception
+ if (error)
+ {
+ socket_.close(); // closing at this point may not be that necessary
+ transport_.errorCallback_();
+ }
+
if (!error && bytes_recvd > 0)
{
try
@@ -120,8 +126,8 @@
else if (offset == 0 && partialDataSize_ == MAX_LENGTH)
{
// very bad... should close connection
- /// @todo Notify somebody
socket_.close();
+ transport_.errorCallback_();
}
}
}
@@ -179,9 +185,11 @@
}
void
-UnixTransport::connect(boost::asio::io_service &ioService, const ReceiveCallback &receiveCallback)
+UnixTransport::connect(boost::asio::io_service &ioService,
+ const ReceiveCallback &receiveCallback,
+ const ErrorCallback &errorCallback)
{
- Transport::connect(ioService, receiveCallback);
+ Transport::connect(ioService, receiveCallback, errorCallback);
impl_ = std::auto_ptr<UnixTransport::Impl> (new UnixTransport::Impl(*this));
impl_->connect();