JsonUi: try to handle all available requests, on input event, not just the first one

This commit is contained in:
Maxime Coste 2016-08-24 23:38:50 +01:00
parent 911a32a992
commit 9124851029

View File

@ -425,7 +425,7 @@ void JsonUI::parse_requests(EventMode mode)
m_requests += StringView{buf, buf + size}; m_requests += StringView{buf, buf + size};
} }
if (not m_requests.empty()) while (not m_requests.empty())
{ {
const char* pos = nullptr; const char* pos = nullptr;
try try
@ -442,7 +442,9 @@ void JsonUI::parse_requests(EventMode mode)
// try to salvage request by dropping its first line // try to salvage request by dropping its first line
pos = std::min(m_requests.end(), find(m_requests, '\n')+1); pos = std::min(m_requests.end(), find(m_requests, '\n')+1);
} }
if (pos) if (not pos)
break; // unterminated request ?
m_requests = String{pos, m_requests.end()}; m_requests = String{pos, m_requests.end()};
} }