From 2e3cec35c283fe19b782222aefc91316203a0064 Mon Sep 17 00:00:00 2001 From: BenDroid Date: Fri, 29 Dec 2017 19:44:27 +0100 Subject: [PATCH] Fixed #10 CCServer spontaneously freezes and holds CPU 100% --- src/cc/Httpd.cpp | 2 +- src/cc/Service.cpp | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/cc/Httpd.cpp b/src/cc/Httpd.cpp index 396d42fa..31bb6784 100644 --- a/src/cc/Httpd.cpp +++ b/src/cc/Httpd.cpp @@ -44,7 +44,7 @@ bool Httpd::start() } m_daemon = MHD_start_daemon(MHD_USE_SELECT_INTERNALLY, static_cast(m_options->ccPort()), nullptr, nullptr, &Httpd::handler, - this, MHD_OPTION_END); + this, MHD_OPTION_CONNECTION_TIMEOUT, (unsigned int) 10, MHD_OPTION_END); if (!m_daemon) { LOG_ERR("HTTP Daemon failed to start."); diff --git a/src/cc/Service.cpp b/src/cc/Service.cpp index ba234bad..e4c05494 100644 --- a/src/cc/Service.cpp +++ b/src/cc/Service.cpp @@ -82,6 +82,8 @@ unsigned Service::handleGET(const Options* options, const std::string& url, cons } } + LOG_INFO("Resp. lengt: %d", resp.length()); + uv_mutex_unlock(&m_mutex); return resultCode; @@ -134,7 +136,7 @@ unsigned Service::getClientConfig(const Options* options, const std::string& cli document.Parse(data.str().c_str()); if (!document.HasParseError()) { - rapidjson::StringBuffer buffer(0, 65536); + rapidjson::StringBuffer buffer(0, 4096); rapidjson::Writer writer(buffer); writer.SetMaxDecimalPlaces(10); document.Accept(writer);