aboutsummaryrefslogtreecommitdiffstats
path: root/libtransport/src/hicn
diff options
context:
space:
mode:
authorMauro Sardara <msardara@cisco.com>2019-12-02 16:32:33 +0100
committerMauro Sardara <msardara@cisco.com>2019-12-02 16:34:42 +0100
commit1c23af13954a151ec56ca3b0372f369db160b80a (patch)
treee0b2a264f57c02a0a4be7623500b1bc7b90ccf88 /libtransport/src/hicn
parent2d1b0a7436653f6eb9e6d2777802b4ae912183b2 (diff)
[HICN-426] Add isRunning API to consumer and producer socket.
Change-Id: I5a144f804b87c3575f24c57ba5086136ec02efcd Signed-off-by: Mauro Sardara <msardara@cisco.com>
Diffstat (limited to 'libtransport/src/hicn')
-rw-r--r--libtransport/src/hicn/transport/interfaces/socket.h2
-rw-r--r--libtransport/src/hicn/transport/interfaces/socket_consumer.h5
-rw-r--r--libtransport/src/hicn/transport/interfaces/socket_producer.h2
3 files changed, 9 insertions, 0 deletions
diff --git a/libtransport/src/hicn/transport/interfaces/socket.h b/libtransport/src/hicn/transport/interfaces/socket.h
index f019488..4c9bda7 100644
--- a/libtransport/src/hicn/transport/interfaces/socket.h
+++ b/libtransport/src/hicn/transport/interfaces/socket.h
@@ -78,6 +78,8 @@ class Socket {
virtual void connect() = 0;
+ virtual bool isRunning() = 0;
+
protected:
virtual ~Socket(){};
diff --git a/libtransport/src/hicn/transport/interfaces/socket_consumer.h b/libtransport/src/hicn/transport/interfaces/socket_consumer.h
index eceee2d..0f83fd3 100644
--- a/libtransport/src/hicn/transport/interfaces/socket_consumer.h
+++ b/libtransport/src/hicn/transport/interfaces/socket_consumer.h
@@ -159,6 +159,11 @@ class ConsumerSocket : public BaseSocket {
void connect() override;
/**
+ * @brief Check whether consumer socket is active or not.
+ */
+ bool isRunning() override { return transport_protocol_->isRunning(); }
+
+ /**
* Retrieve a content using the protocol specified in the constructor.
* This function blocks until the whole content is downloaded.
* For monitoring the status of the download, the application MUST set the
diff --git a/libtransport/src/hicn/transport/interfaces/socket_producer.h b/libtransport/src/hicn/transport/interfaces/socket_producer.h
index 1f1acd4..83d0f73 100644
--- a/libtransport/src/hicn/transport/interfaces/socket_producer.h
+++ b/libtransport/src/hicn/transport/interfaces/socket_producer.h
@@ -51,6 +51,8 @@ class ProducerSocket : public Socket<BasePortal>,
void connect() override;
+ bool isRunning() override { return !io_service_.stopped(); };
+
uint32_t produce(Name content_name, const uint8_t *buffer, size_t buffer_size,
bool is_last = true, uint32_t start_offset = 0) {
return produce(content_name, utils::MemBuf::copyBuffer(buffer, buffer_size),