...
This commit is contained in:
@@ -364,9 +364,9 @@ public:
|
||||
|
||||
// auto s_res = std::make_shared<std::invoke_result_t<decltype(this->template search<RMSGT>), RMSGT>>();
|
||||
|
||||
auto tp = this->search(std::span<const char>());
|
||||
auto s_res = std::make_shared<decltype(tp)>();
|
||||
// auto s_res = std::make_shared<std::tuple<asio_streambuff_iter_t, asio_streambuff_iter_t, bool>>();
|
||||
// auto tp = this->search(std::span<const char>());
|
||||
// auto s_res = std::make_shared<decltype(tp)>();
|
||||
auto s_res = std::make_shared<std::tuple<asio_streambuff_iter_t, asio_streambuff_iter_t, bool>>();
|
||||
|
||||
auto out_flags = std::make_shared<asio::socket_base::message_flags>();
|
||||
|
||||
@@ -432,7 +432,9 @@ public:
|
||||
}
|
||||
|
||||
// here, the iterators were computed in MatchCondition called by asio::async_read_until function!!!
|
||||
std::string_view net_pack{std::get<0>(*s_res), std::get<1>(*s_res)};
|
||||
// std::string_view net_pack{std::get<0>(*s_res), std::get<1>(*s_res)};
|
||||
size_t N = std::distance(std::get<0>(*s_res), std::get<1>(*s_res));
|
||||
std::span net_pack{&*std::get<0>(*s_res), N};
|
||||
|
||||
std::ranges::copy(this->fromProto(net_pack), std::back_inserter(msg));
|
||||
_streamBuffer.consume(net_pack.size());
|
||||
@@ -442,14 +444,20 @@ public:
|
||||
// auto end_it = (const char*)asio_streambuff_iter_t::end(_streamBuffer.data());
|
||||
// auto begin_it = asio_streambuff_iter_t::begin(_streamBuffer.data());
|
||||
// auto end_it = asio_streambuff_iter_t::end(_streamBuffer.data());
|
||||
auto begin_it =
|
||||
static_cast<std::ranges::iterator_t<std::string_view>>(_streamBuffer.data().data());
|
||||
auto end_it = begin_it + _streamBuffer.data().size();
|
||||
// auto begin_it =
|
||||
// static_cast<std::ranges::iterator_t<std::string_view>>(_streamBuffer.data().data());
|
||||
// auto end_it = begin_it + _streamBuffer.data().size();
|
||||
|
||||
auto begin_it = asio::buffers_begin(_streamBuffer.data());
|
||||
auto end_it = asio::buffers_end(_streamBuffer.data());
|
||||
|
||||
|
||||
*s_res = this->search(std::span(begin_it, end_it));
|
||||
// *s_res = this->search(std::span(begin_it, end_it));
|
||||
*s_res = this->search(begin_it, end_it);
|
||||
if (std::get<2>(*s_res)) {
|
||||
net_pack = std::string_view{std::get<0>(*s_res), std::get<1>(*s_res)};
|
||||
// net_pack = std::string_view{std::get<0>(*s_res), std::get<1>(*s_res)};
|
||||
N = std::distance(std::get<0>(*s_res), std::get<1>(*s_res));
|
||||
net_pack = std::span{&*std::get<0>(*s_res), N};
|
||||
|
||||
_receiveQueue.emplace();
|
||||
std::ranges::copy(this->fromProto(net_pack), std::back_inserter(_receiveQueue.back()));
|
||||
@@ -563,12 +571,13 @@ protected:
|
||||
template <typename T>
|
||||
auto MatchCondition(asio_streambuff_iter_t begin, asio_streambuff_iter_t end, T& s_res)
|
||||
{
|
||||
if (begin == end) {
|
||||
*s_res = this->search(std::span<const char>());
|
||||
} else {
|
||||
*s_res = this->search(std::span(&*begin, &*end));
|
||||
// *s_res = this->search(begin, end);
|
||||
}
|
||||
// if (begin == end) {
|
||||
// *s_res = this->search(std::span<const char>());
|
||||
// } else {
|
||||
// *s_res = this->search(std::span(&*begin, &*end));
|
||||
// }
|
||||
|
||||
*s_res = this->search(begin, end);
|
||||
|
||||
// return std::make_pair(std::get<1>(*s_res), std::get<2>(*s_res));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user