aboutsummaryrefslogtreecommitdiffstats
path: root/libtransport/src/hicn/transport/interfaces/socket_consumer.cc
diff options
context:
space:
mode:
authorMauro Sardara <msardara@cisco.com>2019-04-03 10:03:56 +0200
committerMauro Sardara <msardara@cisco.com>2019-04-15 11:37:30 +0200
commitc365689250216861fd7727203ee6ba1049ad5778 (patch)
tree97f1f3d1a6cb7314f1292d97be6d8e8e06cc998b /libtransport/src/hicn/transport/interfaces/socket_consumer.cc
parentd8ce6d98a2a726393655bd71eb81b8ef5222d6ba (diff)
[HICN-155] Consumer socket allows now to read N bytes from the network, where N is defined by the application.
Change-Id: Ib20309b40e43e4c0db09b9b484e18cd2e3ebf581 Signed-off-by: Mauro Sardara <msardara@cisco.com>
Diffstat (limited to 'libtransport/src/hicn/transport/interfaces/socket_consumer.cc')
-rw-r--r--libtransport/src/hicn/transport/interfaces/socket_consumer.cc14
1 files changed, 5 insertions, 9 deletions
diff --git a/libtransport/src/hicn/transport/interfaces/socket_consumer.cc b/libtransport/src/hicn/transport/interfaces/socket_consumer.cc
index ca97228..37d5457 100644
--- a/libtransport/src/hicn/transport/interfaces/socket_consumer.cc
+++ b/libtransport/src/hicn/transport/interfaces/socket_consumer.cc
@@ -48,7 +48,6 @@ ConsumerSocket::ConsumerSocket(int protocol, asio::io_service &io_service)
is_async_(false),
verifier_(std::make_shared<utils::Verifier>()),
verify_signature_(false),
- content_buffer_(nullptr),
on_interest_output_(VOID_HANDLER),
on_interest_timeout_(VOID_HANDLER),
on_interest_satisfied_(VOID_HANDLER),
@@ -56,7 +55,8 @@ ConsumerSocket::ConsumerSocket(int protocol, asio::io_service &io_service)
on_content_object_verification_(VOID_HANDLER),
on_content_object_(VOID_HANDLER),
on_manifest_(VOID_HANDLER),
- on_payload_retrieved_(VOID_HANDLER),
+ stats_summary_(VOID_HANDLER),
+ read_callback_(nullptr),
virtual_download_(false),
rtt_stats_(false),
timer_interval_milliseconds_(0) {
@@ -81,13 +81,11 @@ ConsumerSocket::~ConsumerSocket() {
void ConsumerSocket::connect() { portal_->connect(); }
-int ConsumerSocket::consume(const Name &name, ContentBuffer &receive_buffer) {
+int ConsumerSocket::consume(const Name &name) {
if (transport_protocol_->isRunning()) {
return CONSUMER_BUSY;
}
- content_buffer_ = receive_buffer;
-
network_name_ = name;
network_name_.setSuffix(0);
is_async_ = false;
@@ -97,14 +95,12 @@ int ConsumerSocket::consume(const Name &name, ContentBuffer &receive_buffer) {
return CONSUMER_FINISHED;
}
-int ConsumerSocket::asyncConsume(const Name &name,
- ContentBuffer &receive_buffer) {
+int ConsumerSocket::asyncConsume(const Name &name) {
if (!async_downloader_.stopped()) {
- async_downloader_.add([this, receive_buffer, name]() {
+ async_downloader_.add([this, name]() {
network_name_ = std::move(name);
network_name_.setSuffix(0);
is_async_ = true;
- content_buffer_ = receive_buffer;
transport_protocol_->start();
});
}