Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Coroutine set #3

Open
wiluite opened this issue Dec 22, 2022 · 0 comments
Open

Coroutine set #3

wiluite opened this issue Dec 22, 2022 · 0 comments

Comments

@wiluite
Copy link

wiluite commented Dec 22, 2022

Thanks for the coroutine set.

The evolution of samples from the first one(02.10) to the result is awesome and produces the expected results.
However, what if one would use it from the perspective to write something more generic:

For example the data for "sending coroutine" could be just:

    std::vector<byte> fakeBytes {
        'H'_B, 'e'_B, 'l'_B, 'l'_B, 'o'_B
    };

and the code in "parsing coroutine" is co-awaiting and just co-yielding (echoing):

    while (true) {
        byte b = co_await byte{};
        std::string frame{};
        frame.push_back(static_cast<char>(b));
        co_yield frame;
    }

And in this sense the modified (02.10) keeps working as expected, but already the next one doesn't (is crashed).
Of course, things were done with an eye to a specific version of the protocol, the outcomes in common seem not functionally equivalent. And I thought that the issues could be interesting.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant