Fix bug in GetStartStreamIndex
This commit is contained in:
parent
d9489ea5d3
commit
2e92c59f50
1 changed files with 8 additions and 6 deletions
|
@ -314,9 +314,6 @@ struct ClientCreateVisitor {
|
|||
};
|
||||
|
||||
auto GetStartStreamIndex(auto& socket, boost::asio::streambuf& streambuf) -> boost::asio::awaitable<std::size_t> {
|
||||
auto buf = streambuf.prepare(4096); // NOLINT
|
||||
std::size_t n = co_await socket.async_read_some(buf, boost::asio::use_awaitable);
|
||||
streambuf.commit(n);
|
||||
auto splited = Splitter{GetEnumerated(streambuf)};
|
||||
using It = decltype(splited.begin());
|
||||
// clang-format off
|
||||
|
@ -327,9 +324,14 @@ struct ClientCreateVisitor {
|
|||
.transform([](auto value) -> boost::asio::awaitable<std::size_t> {
|
||||
auto [n, _] = *value;
|
||||
co_return n;
|
||||
})
|
||||
.or_else([&] -> std::optional<boost::asio::awaitable<std::size_t>> {
|
||||
return this->GetStartStreamIndex(socket, streambuf);
|
||||
}) // NOLINTNEXTLINE
|
||||
.or_else([&] { // NOLINTNEXTLINE
|
||||
return std::optional{[](auto self, auto& socket, auto& streambuf) -> boost::asio::awaitable<std::size_t> {
|
||||
auto buf = streambuf.prepare(4096); // NOLINT
|
||||
std::size_t n = co_await socket.async_read_some(buf, boost::asio::use_awaitable);
|
||||
streambuf.commit(n);
|
||||
co_return co_await self->GetStartStreamIndex(socket, streambuf);
|
||||
}(this, socket, streambuf)};
|
||||
})
|
||||
.value();
|
||||
// clang-format on
|
||||
|
|
Loading…
Reference in a new issue