summaryrefslogtreecommitdiffhomepage
path: root/plugins/fcgi/fcgiid.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/fcgi/fcgiid.cpp')
-rw-r--r--plugins/fcgi/fcgiid.cpp19
1 files changed, 19 insertions, 0 deletions
diff --git a/plugins/fcgi/fcgiid.cpp b/plugins/fcgi/fcgiid.cpp
new file mode 100644
index 0000000..778cbc9
--- /dev/null
+++ b/plugins/fcgi/fcgiid.cpp
@@ -0,0 +1,19 @@
+#include "fcgiid.h"
+
+ // starting at 1
+uint16_t FCGI_ID::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 FCGI_ID::putID(uint16_t id)
+{
+ m_unused.insert(id);
+}