summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorClaudius "keldu" Holeksa <mail@keldu.de>2024-07-20 16:57:22 +0200
committerClaudius "keldu" Holeksa <mail@keldu.de>2024-07-20 16:57:22 +0200
commitf802fb4d988a9b6ebfe49120343561232396cab6 (patch)
tree7a42c5fc58967019c86cb7dcc656901b1b36a83c /modules
parent53d47a9a5a8130e5af1215bbb2c2fb663a81dc30 (diff)
wip
Diffstat (limited to 'modules')
-rw-r--r--modules/codec/c++/simple.hpp4
-rw-r--r--modules/io_codec/c++/io_peer.tmpl.hpp21
2 files changed, 9 insertions, 16 deletions
diff --git a/modules/codec/c++/simple.hpp b/modules/codec/c++/simple.hpp
index b0b353e..1afdc33 100644
--- a/modules/codec/c++/simple.hpp
+++ b/modules/codec/c++/simple.hpp
@@ -18,6 +18,10 @@ private:
public:
data() = default;
+ data(ring_buffer buffer__):
+ buffer_{std::move(buffer__)}
+ {}
+
buffer& get_buffer(){
return buffer_;
}
diff --git a/modules/io_codec/c++/io_peer.tmpl.hpp b/modules/io_codec/c++/io_peer.tmpl.hpp
index 4e20bd0..a3ef9b6 100644
--- a/modules/io_codec/c++/io_peer.tmpl.hpp
+++ b/modules/io_codec/c++/io_peer.tmpl.hpp
@@ -7,7 +7,7 @@ streaming_io_peer<Incoming, Outgoing, Encoding,
streaming_io_peer(
own<conveyor_feeder<data<Incoming, Encoding>>> feed,
own<async_io_stream> str)
- : streaming_io_peer{std::move(feed), std::move(str), {}, {}, {}} {}
+ : streaming_io_peer{std::move(feed), std::move(str), {}, {}, {}, {}} {}
template <typename Incoming, typename Outgoing, typename Encoding, typename BufferT>
streaming_io_peer<Incoming, Outgoing, Encoding,
@@ -34,20 +34,9 @@ streaming_io_peer<Incoming, Outgoing, Encoding,
while (true) {
buffer_view in_view{in_buffer_};
- auto in_data = data<Incoming, Encoding>(in_view);
- auto nat_data = data<Incoming>{};
-
- error err = in_codec_.template decode<Incoming, Encoding>(
- in_data, nat_data);
- if (err.is_critical()) {
- return err;
- }
-
- if (!err.failed()) {
- incoming_feeder_->feed(std::move(nat_data));
- } else {
- break;
- }
+ auto in_data = data<Incoming, Encoding>{in_view};
+
+ incoming_feeder_->feed(std::move(in_data));
}
return void_t{};
@@ -108,7 +97,7 @@ std::pair<own<streaming_io_peer<Incoming, Outgoing, Encoding, BufferT>>,
conveyor<data<Incoming,Encoding>>>
new_streaming_io_peer(own<async_io_stream> stream) {
auto caf =
- new_conveyor_and_feeder<data<Incoming>>();
+ new_conveyor_and_feeder<data<Incoming, Encoding>>();
return {heap<streaming_io_peer<Incoming, Outgoing, Encoding,BufferT>>(
std::move(caf.feeder), std::move(stream)),