diff options
author | Roland Reichwein <mail@reichwein.it> | 2020-05-03 09:25:38 +0200 |
---|---|---|
committer | Roland Reichwein <mail@reichwein.it> | 2020-05-03 09:25:38 +0200 |
commit | f49cd79ed8cdb1cb8988aad2cfa3f22d4866fb27 (patch) | |
tree | afc33b8232ba9e0bf8871657c0e8bdd968e3aedc /plugins/fcgi/fcgi.cpp | |
parent | 5f39c4bcd3ea85ce6a30446d23ccae0542bfbdaf (diff) |
FCGI: Fix multithreading for m_socket
Diffstat (limited to 'plugins/fcgi/fcgi.cpp')
-rw-r--r-- | plugins/fcgi/fcgi.cpp | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/plugins/fcgi/fcgi.cpp b/plugins/fcgi/fcgi.cpp index b9e279f..416ca24 100644 --- a/plugins/fcgi/fcgi.cpp +++ b/plugins/fcgi/fcgi.cpp @@ -347,6 +347,9 @@ std::string fcgi_plugin::fcgiQuery(FCGIContext& context) if (pos != app_addr.npos) { // host:port auto endpoints{m_resolver.resolve(app_addr.substr(0, pos), app_addr.substr(pos + 1))}; bool opening{false}; + + std::lock_guard<std::mutex> socket_lock{m_socket_mutex}; + if (!m_socket.is_open()) { std::cout << "FCGI: Opening new socket" << std::endl; boost::asio::connect(m_socket, endpoints); @@ -434,8 +437,17 @@ std::string fcgi_plugin::fcgiQuery(FCGIContext& context) } } } - } else { // Unix domain socket, or file to start + } else if (fs::is_socket(fs::path{app_addr})) { // Unix domain socket + // TODO + std::cerr << "FCGI Error: Unix domain sockets not yet implemented." << std::endl; + return HttpStatus("500", "FCGI configuration", context.SetResponseHeader); + } else if (fs::is_regular_file(fs::path{app_addr})) { // Executable to start // TODO + std::cerr << "FCGI Error: Executable FCGI not yet implemented." << std::endl; + return HttpStatus("500", "FCGI configuration", context.SetResponseHeader); + } else { + std::cerr << "FCGI Error: Invalid app_addr type." << std::endl; + return HttpStatus("500", "FCGI configuration", context.SetResponseHeader); } std::istringstream is_out{output_data}; |