summaryrefslogtreecommitdiffstats
path: root/src/webclientserver.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/webclientserver.cpp')
-rw-r--r--src/webclientserver.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/webclientserver.cpp b/src/webclientserver.cpp
index f690cf5..3e0f7eb 100644
--- a/src/webclientserver.cpp
+++ b/src/webclientserver.cpp
@@ -187,6 +187,8 @@ Server::Server(quint16 port)
bytesRead = 0;
serverStart = QDateTime::currentDateTime();
totalSessions = 0;
+
+ activeSessionLimitHtml = "<html><body>Active session limit exceeded.</body></html>";
}
Server::~Server()
@@ -264,6 +266,13 @@ void Server::dataOnSocket()
// ### accept unknown sessions for now, TODO do authentication here.
DEBUG << "new session for" << sessionId;
+ if (totalSessions >= activeSessionLimit) {
+ dynamicBytesWritten += activeSessionLimitHtml.size();
+ socket->write(activeSessionLimitHtml);
+ socket->disconnectFromHost();
+ return;
+ }
+
++totalSessions;
sessionId = nextCookieId;
nextCookieId = qrand(); // ###