From c365689250216861fd7727203ee6ba1049ad5778 Mon Sep 17 00:00:00 2001 From: Mauro Sardara Date: Wed, 3 Apr 2019 10:03:56 +0200 Subject: [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 --- .../src/hicn/transport/interfaces/socket_consumer.cc | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) (limited to 'libtransport/src/hicn/transport/interfaces/socket_consumer.cc') diff --git a/libtransport/src/hicn/transport/interfaces/socket_consumer.cc b/libtransport/src/hicn/transport/interfaces/socket_consumer.cc index ca9722849..37d545779 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()), 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(); }); } -- cgit 1.2.3-korg