aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ctrl/facemgr/src/facelet.c12
-rw-r--r--libtransport/src/hicn/transport/core/udp_socket_connector.cc8
-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
5 files changed, 27 insertions, 2 deletions
diff --git a/ctrl/facemgr/src/facelet.c b/ctrl/facemgr/src/facelet.c
index 929005f57..a6231f457 100644
--- a/ctrl/facemgr/src/facelet.c
+++ b/ctrl/facemgr/src/facelet.c
@@ -998,7 +998,8 @@ facelet_snprintf(char * s, size_t size, const facelet_t * facelet)
assert(facelet);
/* Header + key attributes (netdevice + family) */
- rc = snprintf(cur, s + size - cur, "<Facelet %s %s (%s)",
+ rc = snprintf(cur, s + size - cur, "<Facelet [%d] %s %s (%s)",
+ facelet->id,
facelet_status_str[facelet->status],
facelet_get_error(facelet) ? "/!\\" : "",
(facelet->family == AF_INET) ? "AF_INET" :
@@ -1208,6 +1209,15 @@ int facelet_snprintf_json(char * s, size_t size, const facelet_t * facelet, int
if (cur >= s + size)
return cur - s;
+ /* id */
+ rc = snprintf(cur, s + size - cur, "%*s%s: %d,\n", 4 * (indent+1), "", "\"id\"",
+ facelet->id);
+ if (rc < 0)
+ return rc;
+ cur += rc;
+ if (cur >= s + size)
+ return cur - s;
+
/* Status */
rc = snprintf(cur, s + size - cur, "%*s%s: \"%s\",\n", 4 * (indent+1), "", "\"status\"",
facelet_status_str[facelet->status]);
diff --git a/libtransport/src/hicn/transport/core/udp_socket_connector.cc b/libtransport/src/hicn/transport/core/udp_socket_connector.cc
index 38945e755..99f47fedf 100644
--- a/libtransport/src/hicn/transport/core/udp_socket_connector.cc
+++ b/libtransport/src/hicn/transport/core/udp_socket_connector.cc
@@ -62,7 +62,13 @@ void UdpSocketConnector::send(const uint8_t *packet, std::size_t len,
});
} else {
if (state_ == ConnectorState::CONNECTED) {
- socket_.send(asio::buffer(packet, len));
+ try {
+ socket_.send(asio::buffer(packet, len));
+ } catch (std::system_error &err) {
+ TRANSPORT_LOGE(
+ "Sending of disconnect message to forwarder failed. Reason: %s",
+ err.what());
+ }
}
}
}
diff --git a/libtransport/src/hicn/transport/interfaces/socket.h b/libtransport/src/hicn/transport/interfaces/socket.h
index f0194880a..4c9bda7df 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 eceee2d34..0f83fd38f 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 1f1acd401..83d0f73f3 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),