diff options
author | Claudius 'keldu' Holeksa <mail@keldu.de> | 2024-08-07 13:26:58 +0200 |
---|---|---|
committer | Claudius 'keldu' Holeksa <mail@keldu.de> | 2024-08-07 13:26:58 +0200 |
commit | e4525015f88bcb7d9906a875210f759621f2b3c3 (patch) | |
tree | f0105983f8afdc0bfd257ac8e8e9246cb87f4112 | |
parent | 3beda6ac36f494df11851b657a4bcc967bceb79d (diff) |
wip
-rw-r--r-- | modules/io_codec/c++/io_peer.hpp | 1 | ||||
-rw-r--r-- | modules/io_codec/c++/io_peer.tmpl.hpp | 15 | ||||
-rw-r--r-- | modules/io_codec/examples/peer_echo_client.cpp | 2 |
3 files changed, 13 insertions, 5 deletions
diff --git a/modules/io_codec/c++/io_peer.hpp b/modules/io_codec/c++/io_peer.hpp index c4e28a1..b998055 100644 --- a/modules/io_codec/c++/io_peer.hpp +++ b/modules/io_codec/c++/io_peer.hpp @@ -4,6 +4,7 @@ #include <forstio/buffer.hpp> #include <forstio/io/io.hpp> #include <forstio/codec/data.hpp> +#include <forstio/codec/transport.hpp> namespace saw { diff --git a/modules/io_codec/c++/io_peer.tmpl.hpp b/modules/io_codec/c++/io_peer.tmpl.hpp index 7329eb2..d6d6364 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, TransportEncoding, ContentEncoding, streaming_io_peer( own<conveyor_feeder<data<Incoming, ContentEncoding>>> 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 TransportEncoding, typename ContentEncoding, typename BufferT> streaming_io_peer<Incoming, Outgoing, TransportEncoding, ContentEncoding, @@ -51,9 +51,9 @@ streaming_io_peer<Incoming, Outgoing, TransportEncoding, ContentEncoding, return std::move(eo_len.get_error()); } auto& len_val = eo_len.get_value(); - in_buffer->write_advance(len_val); + in_buffer_.write_advance(len_val); - data<Incoming, ContentEncoding> in_data{std::move(array_buffer)}; + data<Incoming, ContentEncoding> in_data{std::move(in_buff)}; incoming_feeder_->feed(std::move(in_data)); } @@ -75,7 +75,12 @@ streaming_io_peer<Incoming, Outgoing, TransportEncoding, ContentEncoding, return void_t{}; }) - .sink()} { + .sink() + }, + conveyor_feeder_{ + *this + } +{ io_stream_->read(&in_buffer_.write(), 1, in_buffer_.write_segment_length()); } @@ -86,9 +91,11 @@ error_or<void> streaming_io_peer<Incoming, Outgoing, TransportEncoding, ContentE msg) { bool restart_write = out_buffer_.read_segment_length() == 0; + /* if (eov.is_error()) { return eov; } + */ if (restart_write) { io_stream_->write(&out_buffer_.read(), diff --git a/modules/io_codec/examples/peer_echo_client.cpp b/modules/io_codec/examples/peer_echo_client.cpp index b09a51a..5177edb 100644 --- a/modules/io_codec/examples/peer_echo_client.cpp +++ b/modules/io_codec/examples/peer_echo_client.cpp @@ -36,7 +36,7 @@ int main(){ network.connect(*addr).then([](saw::own<saw::io_stream> client){ auto echo_stream = saw::heap<saw::async_io_stream>(std::move(client)); - auto echo_peer_stream_p = saw::new_streaming_io_peer<sch::Echo, sch::Echo, transport::FixedLength<8u>, encode::KelSimple, ring_buffer>(std::move(echo_stream)); + auto echo_peer_stream_p = saw::new_streaming_io_peer<sch::Echo, sch::Echo, trans::FixedLength<8u>, encode::KelSimple, ring_buffer>(std::move(echo_stream)); echo_peer_stream_p.first->on_read_disconnected().attach(std::move(echo_peer_stream_p.first)).detach(); }).detach(); |