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};
}
if (not m_requests.empty())
while (not m_requests.empty())
{
const char* pos = nullptr;
try
@ -442,8 +442,10 @@ void JsonUI::parse_requests(EventMode mode)
// try to salvage request by dropping its first line
pos = std::min(m_requests.end(), find(m_requests, '\n')+1);
}
if (pos)
m_requests = String{pos, m_requests.end()};
if (not pos)
break; // unterminated request ?
m_requests = String{pos, m_requests.end()};
}
while (m_input_callback and not m_pending_keys.empty())