face: When there are no more events to process, pausing transport instead of closing it
Change-Id: I12ad55c6ef3b6b3fce4a5b3c679eb0c6dc3cfa07
Refs: #1314
diff --git a/src/transport/transport.hpp b/src/transport/transport.hpp
index c309288..da06da4 100644
--- a/src/transport/transport.hpp
+++ b/src/transport/transport.hpp
@@ -38,7 +38,7 @@
* Close the connection.
*/
virtual void
- close() =0;
+ close() = 0;
/**
* @brief Set data to the host
@@ -47,7 +47,7 @@
* @param dataLength The number of bytes in data.
*/
virtual void
- send(const Block& wire) =0;
+ send(const Block& wire) = 0;
/**
* @brief Alternative version of sending data, applying scatter/gather I/O concept
@@ -56,11 +56,20 @@
* same message in datagram-oriented transports.
*/
virtual void
- send(const Block& header, const Block& payload) =0;
+ send(const Block& header, const Block& payload) = 0;
+
+ virtual void
+ pause() = 0;
+
+ virtual void
+ resume() = 0;
inline bool
isConnected();
+ inline bool
+ isExpectingData();
+
protected:
inline void
receive(const Block& wire);
@@ -68,6 +77,7 @@
protected:
boost::asio::io_service* m_ioService;
bool m_isConnected;
+ bool m_isExpectingData;
ReceiveCallback m_receiveCallback;
};
@@ -75,6 +85,7 @@
Transport::Transport()
: m_ioService(0)
, m_isConnected(false)
+ , m_isExpectingData(false)
{
}
@@ -102,6 +113,12 @@
return m_isConnected;
}
+inline bool
+Transport::isExpectingData()
+{
+ return m_isExpectingData;
+}
+
inline void
Transport::receive(const Block& wire)
{