fix log thread bug, add clean memory button, fix pinch zoom bug, set android back button to undo
This commit is contained in:
@@ -12,7 +12,7 @@ static size_t data_handler(void *contents, size_t size, size_t nmemb, void *user
|
||||
|
||||
void LogRemote::start()
|
||||
{
|
||||
if (m_running)
|
||||
if (m_running || m_error)
|
||||
return; // already running
|
||||
|
||||
m_running = true;
|
||||
@@ -20,7 +20,7 @@ void LogRemote::start()
|
||||
net_init();
|
||||
auto session_string = net_request("/start");
|
||||
m_session = atoi(session_string.c_str());
|
||||
while (m_running)
|
||||
while (m_running && !m_error)
|
||||
{
|
||||
auto m = m_mq.Get();
|
||||
auto escaped = curl_easy_escape(curl, m.c_str(), (int)m.size());
|
||||
@@ -30,6 +30,7 @@ void LogRemote::start()
|
||||
net_request("/log", std::string(data.get(), sz));
|
||||
}
|
||||
net_close();
|
||||
LOG("NET thread loop exit");
|
||||
});
|
||||
}
|
||||
void LogRemote::net_init()
|
||||
@@ -50,7 +51,11 @@ std::string LogRemote::net_request(std::string cmd, std::string data /*= ""*/)
|
||||
curl_easy_setopt(curl, CURLOPT_URL, url.c_str());
|
||||
res = curl_easy_perform(curl);
|
||||
if (res != CURLcode::CURLE_OK)
|
||||
{
|
||||
LOG("NET error, closed");
|
||||
m_running = false;
|
||||
m_error = true;
|
||||
}
|
||||
return readBuffer;
|
||||
}
|
||||
void LogRemote::net_close()
|
||||
@@ -58,6 +63,7 @@ void LogRemote::net_close()
|
||||
if (curl)
|
||||
curl_easy_cleanup(curl);
|
||||
curl = nullptr;
|
||||
m_running = false;
|
||||
}
|
||||
void LogRemote::log(const char* format, ...)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user