diff options
author | Mauro Sardara <msardara@cisco.com> | 2020-05-14 20:21:02 +0200 |
---|---|---|
committer | Mauro Sardara <msardara@cisco.com> | 2020-05-20 10:45:53 +0200 |
commit | 81fb39606b069fbece973995572fa7f90ea1950a (patch) | |
tree | 10c1534707c725eb654741e5b4d280a17ef0c0dc /libtransport/src/protocols/byte_stream_reassembly.cc | |
parent | 67b86555b33c641de14d3c1d0864e571370a71e6 (diff) |
[HICN-613] Add io_service to ConsumerSocket constructor.
Change-Id: Ic1952388e1d2b1e7457c71ae8a959d97aa0cd2d6
Signed-off-by: Mauro Sardara <msardara@cisco.com>
Diffstat (limited to 'libtransport/src/protocols/byte_stream_reassembly.cc')
-rw-r--r-- | libtransport/src/protocols/byte_stream_reassembly.cc | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/libtransport/src/protocols/byte_stream_reassembly.cc b/libtransport/src/protocols/byte_stream_reassembly.cc index 12631637e..6662bec3f 100644 --- a/libtransport/src/protocols/byte_stream_reassembly.cc +++ b/libtransport/src/protocols/byte_stream_reassembly.cc @@ -16,7 +16,6 @@ #include <hicn/transport/interfaces/socket_consumer.h> #include <hicn/transport/utils/array.h> #include <hicn/transport/utils/membuf.h> - #include <implementation/socket_consumer.h> #include <protocols/byte_stream_reassembly.h> #include <protocols/errors.h> @@ -67,7 +66,9 @@ void ByteStreamReassembly::assembleContent() { while (it != received_packets_.end()) { // Check if valid packet if (it->second) { - copyContent(*it->second); + if (TRANSPORT_EXPECT_FALSE(copyContent(*it->second))) { + return; + } } received_packets_.erase(it); @@ -80,7 +81,9 @@ void ByteStreamReassembly::assembleContent() { } } -void ByteStreamReassembly::copyContent(const ContentObject &content_object) { +bool ByteStreamReassembly::copyContent(const ContentObject &content_object) { + bool ret = false; + auto payload = content_object.getPayloadReference(); auto payload_length = payload.second; auto write_size = std::min(payload_length, read_buffer_->tailroom()); @@ -102,10 +105,13 @@ void ByteStreamReassembly::copyContent(const ContentObject &content_object) { index_manager_->getFinalSuffix() == content_object.getName().getSuffix(); if (TRANSPORT_EXPECT_FALSE(download_complete_)) { + ret = download_complete_; notifyApplication(); transport_protocol_->onContentReassembled( make_error_code(protocol_error::success)); } + + return ret; } void ByteStreamReassembly::reInitialize() { |