Fixed an internal command handler hangup per client
This commit is contained in:
parent
b785cd52ba
commit
84a08c469b
@ -25,8 +25,9 @@ bool command_parser::parse(bool command) {
|
|||||||
|
|
||||||
while(index < this->data.size()) {
|
while(index < this->data.size()) {
|
||||||
findex = this->data.find('|', index);
|
findex = this->data.find('|', index);
|
||||||
if(findex == std::string::npos)
|
if(findex == std::string::npos) {
|
||||||
findex = this->data.size();
|
findex = this->data.size();
|
||||||
|
}
|
||||||
|
|
||||||
this->_bulks.emplace_back(this->_bulks.size() - 1, index, this->data.substr(index, findex - index));
|
this->_bulks.emplace_back(this->_bulks.size() - 1, index, this->data.substr(index, findex - index));
|
||||||
index = findex + 1;
|
index = findex + 1;
|
||||||
@ -35,8 +36,9 @@ bool command_parser::parse(bool command) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
std::string_view command_parser::payload_view(size_t bulk_index) const noexcept {
|
std::string_view command_parser::payload_view(size_t bulk_index) const noexcept {
|
||||||
if(bulk_index >= this->bulk_count())
|
if(bulk_index >= this->bulk_count()) {
|
||||||
return {};
|
return {};
|
||||||
|
}
|
||||||
|
|
||||||
auto bulk = this->bulk(bulk_index);
|
auto bulk = this->bulk(bulk_index);
|
||||||
return this->data.substr(bulk.command_character_index());
|
return this->data.substr(bulk.command_character_index());
|
||||||
@ -50,8 +52,10 @@ std::optional<size_t> command_parser::next_bulk_containing(const std::string_vie
|
|||||||
if(next == std::string::npos) return std::nullopt;
|
if(next == std::string::npos) return std::nullopt;
|
||||||
|
|
||||||
size_t upper_bulk{start + 1};
|
size_t upper_bulk{start + 1};
|
||||||
for(; upper_bulk < this->bulk_count(); upper_bulk++)
|
for(; upper_bulk < this->bulk_count(); upper_bulk++) {
|
||||||
if(this->bulk(upper_bulk).command_character_index() > next)
|
if(this->bulk(upper_bulk).command_character_index() > next) {
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
return upper_bulk - 1;
|
return upper_bulk - 1;
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user