diff options
Diffstat (limited to 'modules/io_codec/examples')
-rw-r--r-- | modules/io_codec/examples/peer_echo_client.cpp | 4 | ||||
-rw-r--r-- | modules/io_codec/examples/peer_echo_server.cpp | 3 |
2 files changed, 5 insertions, 2 deletions
diff --git a/modules/io_codec/examples/peer_echo_client.cpp b/modules/io_codec/examples/peer_echo_client.cpp index d923bc7..3ae67ca 100644 --- a/modules/io_codec/examples/peer_echo_client.cpp +++ b/modules/io_codec/examples/peer_echo_client.cpp @@ -76,7 +76,9 @@ int main(){ }).detach(); auto peer_str = echo_peer_stream_p.first.get(); - peer_str->on_read_disconnected().attach(std::move(echo_peer_stream_p.first)).then([]() -> error_or<void>{ + peer_str->on_disconnected().attach(std::move(echo_peer_stream_p.first)).then([&]() -> error_or<void>{ + keep_running = false; + std::cout<<"disconnect"<<std::endl; return make_error<err::critical>("Destroy pipeline on purpose :>"); }).detach(); diff --git a/modules/io_codec/examples/peer_echo_server.cpp b/modules/io_codec/examples/peer_echo_server.cpp index 87bf721..d579622 100644 --- a/modules/io_codec/examples/peer_echo_server.cpp +++ b/modules/io_codec/examples/peer_echo_server.cpp @@ -86,7 +86,8 @@ int main(){ return make_void(); }).detach(); - peer_str->on_read_disconnected().attach(std::move(echo_peer_stream_p.first)).then([]() -> error_or<void>{ + peer_str->on_disconnected().attach(std::move(echo_peer_stream_p.first)).then([]() -> error_or<void>{ + std::cout<<"Disconnected client"<<std::endl; return make_error<err::critical>("Destroy pipeline on purpose :>"); }).detach(); }).detach(); |