diff options
author | S. Davilla <davilla@4pi.com> | 2015-12-18 20:10:26 -0500 |
---|---|---|
committer | Memphiz <memphis@machzwo.de> | 2016-03-22 15:12:47 +0100 |
commit | 16aa40b4deb732c15ee3f587c06dc51724188b2f (patch) | |
tree | 67aeed2fd6d16bce73233d219a15028d240295da | |
parent | 67c6591d005baf7aadaaaf3925f4a23b92885414 (diff) |
[darwin/WebServer] - fixed crash under json. double thread stack size for libmicrohttpd for osx/ios
-rw-r--r-- | xbmc/network/WebServer.cpp | 22 | ||||
-rw-r--r-- | xbmc/network/WebServer.h | 1 |
2 files changed, 21 insertions, 2 deletions
diff --git a/xbmc/network/WebServer.cpp b/xbmc/network/WebServer.cpp index b79b077460..b28b09dd85 100644 --- a/xbmc/network/WebServer.cpp +++ b/xbmc/network/WebServer.cpp @@ -30,6 +30,10 @@ #include <stdexcept> #include <utility> +#if defined(TARGET_POSIX) +#include <pthread.h> +#endif + #include "filesystem/File.h" #include "network/httprequesthandler/IHTTPRequestHandler.h" #include "settings/Settings.h" @@ -90,9 +94,22 @@ CWebServer::CWebServer() m_daemon_ip4(NULL), m_running(false), m_needcredentials(false), + m_thread_stacksize(0), m_Credentials64Encoded("eGJtYzp4Ym1j") // xbmc:xbmc - -{ } +{ +#if defined(TARGET_DARWIN) + void *stack_addr; + pthread_attr_t attr; + pthread_attr_init(&attr); + pthread_attr_getstack(&attr, &stack_addr, &m_thread_stacksize); + pthread_attr_destroy(&attr); + // double the stack size under darwin, not sure why yet + // but it stoped crashing using Kodi iOS remote -> play video. + // non-darwin will pass a value of zero which means 'system default' + m_thread_stacksize *= 2; + CLog::Log(LOGDEBUG, "CWebServer: increasing thread stack to %zu", m_thread_stacksize); +#endif +} HTTPMethod CWebServer::GetMethod(const char *method) { @@ -1133,6 +1150,7 @@ struct MHD_Daemon* CWebServer::StartMHD(unsigned int flags, int port) #if (MHD_VERSION >= 0x00040001) MHD_OPTION_EXTERNAL_LOGGER, &logFromMHD, NULL, #endif // MHD_VERSION >= 0x00040001 + MHD_OPTION_THREAD_STACK_SIZE, m_thread_stacksize, MHD_OPTION_END); } diff --git a/xbmc/network/WebServer.h b/xbmc/network/WebServer.h index fa2e0d4604..f57d709cf5 100644 --- a/xbmc/network/WebServer.h +++ b/xbmc/network/WebServer.h @@ -121,6 +121,7 @@ private: struct MHD_Daemon *m_daemon_ip4; bool m_running; bool m_needcredentials; + size_t m_thread_stacksize; std::string m_Credentials64Encoded; CCriticalSection m_critSection; static std::vector<IHTTPRequestHandler *> m_requestHandlers; |