From 5f946d3dba74a7d3bc12bc75c4e7e7ed58805d58 Mon Sep 17 00:00:00 2001 From: Claudius 'keldu' Holeksa Date: Fri, 19 Jul 2024 19:15:32 +0200 Subject: wip --- modules/io_codec/c++/io_peer.tmpl.hpp | 4 ++-- modules/io_codec/examples/echo.hpp | 9 +++++++++ modules/io_codec/examples/peer_echo_client.cpp | 10 +++++++--- modules/remote/c++/transfer_loopback.hpp | 9 +++++++++ 4 files changed, 27 insertions(+), 5 deletions(-) diff --git a/modules/io_codec/c++/io_peer.tmpl.hpp b/modules/io_codec/c++/io_peer.tmpl.hpp index 26793b1..3dc11c8 100644 --- a/modules/io_codec/c++/io_peer.tmpl.hpp +++ b/modules/io_codec/c++/io_peer.tmpl.hpp @@ -103,8 +103,8 @@ streaming_io_peeron_read_disconnected(); } -template -std::pair>, +template +std::pair>, conveyor>> new_streaming_io_peer(own stream) { auto caf = diff --git a/modules/io_codec/examples/echo.hpp b/modules/io_codec/examples/echo.hpp index 71be1a0..84b9b31 100644 --- a/modules/io_codec/examples/echo.hpp +++ b/modules/io_codec/examples/echo.hpp @@ -3,6 +3,15 @@ #include #include +#include +#include + +namespace sch { +using namespace saw::schema; + +using Echo = String; +} + namespace saw { constexpr std::string echo_address = "::1"; constexpr uint16_t echo_port = 4322; diff --git a/modules/io_codec/examples/peer_echo_client.cpp b/modules/io_codec/examples/peer_echo_client.cpp index e8c8f82..f1836e4 100644 --- a/modules/io_codec/examples/peer_echo_client.cpp +++ b/modules/io_codec/examples/peer_echo_client.cpp @@ -5,6 +5,8 @@ #include int main(){ + using namespace saw; + auto eo_aio = saw::setup_async_io(); if(eo_aio.is_error()){ auto& err = eo_aio.get_error(); @@ -29,10 +31,12 @@ int main(){ return -1; } auto& addr = eo_addr.get_value(); - saw::own echo_stream = nullptr; - network.connect(*addr).then([&echo_stream](saw::own client){ - echo_stream = saw::heap(std::move(client)); + network.connect(*addr).then([](saw::own client){ + auto echo_stream = saw::heap(std::move(client)); + auto echo_peer_stream_p = saw::new_streaming_io_peer(std::move(echo_stream)); + + echo_peer_stream_p.first->on_read_disconnected().attach(std::move(echo_peer_stream_p.first)).detach(); }).detach(); return 0; diff --git a/modules/remote/c++/transfer_loopback.hpp b/modules/remote/c++/transfer_loopback.hpp index 6c81c9c..f148281 100644 --- a/modules/remote/c++/transfer_loopback.hpp +++ b/modules/remote/c++/transfer_loopback.hpp @@ -32,6 +32,15 @@ public: return void_t{}; } + /** + * + */ + template + error_or allocate(id store_id){ + + return make_error(); + } + template error_or> receive(id store_id){ auto& vals = std::get>>(values_); -- cgit v1.2.3