summaryrefslogtreecommitdiffhomepage
path: root/plugins/fcgi/fcgi.h
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/fcgi/fcgi.h')
-rw-r--r--plugins/fcgi/fcgi.h35
1 files changed, 4 insertions, 31 deletions
diff --git a/plugins/fcgi/fcgi.h b/plugins/fcgi/fcgi.h
index 4f77719..289c4d6 100644
--- a/plugins/fcgi/fcgi.h
+++ b/plugins/fcgi/fcgi.h
@@ -2,38 +2,14 @@
#include "../../plugin_interface.h"
+#include "socket.h"
+
#include <boost/asio.hpp>
#include <cstdint>
#include <mutex>
#include <set>
-// TODO: multithreading
-class FCGI_ID
-{
- std::set<uint16_t >m_unused;
- uint16_t m_current_max{};
-
-public:
- FCGI_ID(){}
-
- // starting at 1
- uint16_t getID(){
- if (m_unused.empty()) {
- m_current_max++;
- return m_current_max;
- } else {
- uint16_t result{*m_unused.begin()};
- m_unused.erase(m_unused.begin());
- return result;
- }
- }
-
- void putID(uint16_t id){
- m_unused.insert(id);
- }
-};
-
// automatically reserves ID, and releases it via RAII
class FCGI_ID_Guard
{
@@ -57,12 +33,9 @@ struct FCGIContext;
class fcgi_plugin: public webserver_plugin_interface
{
- FCGI_ID m_fcgi_id;
- boost::asio::io_context m_io_context;
- boost::asio::ip::tcp::resolver m_resolver;
+ SocketFactory m_socket_factory;
- std::mutex m_socket_mutex; // guard m_socket use in different threads
- std::unordered_map<std::string, boost::asio::ip::tcp::socket> m_sockets;
+ std::unordered_map<std::string, std::shared_ptr<Socket>> m_sockets;
public:
fcgi_plugin();